Commits

Alex Suraci  committed c293993

updates for latest atomo
Ignore-this: bd2c5616661458e6f40b0383b2e2bab1

  • Participants
  • Parent commits f5108c4

Comments (0)

Files changed (1)

     toValue (JSBool b) = return $ Boolean b
     toValue (JSRational _ r) = return (Double (fromRational r))
     toValue (JSString s) = return (string . fromJSString $ s)
-    toValue (JSArray vs) = mapM toValue vs >>= list
+    toValue (JSArray vs) = mapM toValue vs >>= return . list
     toValue (JSObject o) = do
         ms <- forM (fromJSObject o) $ \(n, j) -> do
             v <- toValue j
     fromValue (Integer i) = return (JSRational True (toRational i))
     fromValue (Double d) = return (JSRational True (toRational d))
     fromValue s@(String _) = return (JSString (toJSString (fromText $ fromString s)))
-    fromValue l@(List _) = do
-        js <- fromList l >>= mapM fromValue
-        return (JSArray js)
+    fromValue l@(List _) = fmap JSArray $ mapM fromValue (fromList l)
 
     fromValue v = do
         ifVM (dispatch (keyword ["delegates-to?"] [v, particle "null"]))
         dispatch (keyword ["as"] [v, json])
 
         [$p|o|] =:: v
-        ms <- eval [$e|o methods singles (map: { (m . _) | [m pattern name, m value] })|] >>= fromList >>= mapM fromList
+        ms <- fmap (map fromList . fromList) $
+            eval [$e|o methods singles (map: { (m . _) | [m pattern name, m value] })|]
 
         js <- forM ms $ \[n, v] -> do
             j <- fromValue v