Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- standardLib = Standard $ Map.fromList
- [("put-line", StandardEntry { eSerialize = Cons (Label "native") (Cons (Label "put-line") Nil)
- , eApply = aPutLine
- , eExecute = ePutLine })
- ,("get-line", StandardEntry { eSerialize = Cons (Label "native") (Cons (Label "get-line") Nil)
- , eApply = aGetLine
- , eExecute = eGetLine })]
- aPutLine (m, x) = Cons (Label "put-line") x
- ePutLine (m, Cons (Label x) Nil) = do putStrLn x
- return (m, Nil)
- ePutLine (m, Cons (Label x) d) = do putStrLn x
- ePutLine (m, d)
- ePutLine (m, Nil) = return (m, Nil)
- ePutLine (m, b) = E.throw $ RuntimeException "type mismatch"
- aGetLine (m, x) = Cons (Label "get-line") x
- eGetLine (m, _) = do l <- getLine
- return (m, Label l)
Add Comment
Please, Sign In to add comment