Created
August 4, 2010 03:17
-
-
Save vito/507581 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import The.Haskell | |
load = do | |
"(x: Object) clone" =: do | |
Reference r <- getSymbol "x" | |
proto <- newProto $ \p -> p | |
{ vpDelegates = [r] | |
} | |
return (Reference proto) | |
"(x: Object) dump" =: do | |
x <- getSymbol "x" | |
liftIO (print x) | |
return x | |
"(x: Object) print" =: do | |
x <- getSymbol "x" | |
printVM x | |
return x | |
"(s: String) write" =: do | |
List cs <- getSymbol "s" | |
if all isChar cs | |
then do | |
liftIO (putStrLn (map (\(Char c) -> c) cs)) | |
return (List cs) | |
else throwError $ ErrorMsg "@write applied to non-String" | |
"(b: Block) apply" =: do | |
Block s as es <- getSymbol "b" | |
if length as > 0 | |
then throwError . ErrorMsg $ "block expects " ++ show (length as) ++ ", given 0" | |
else doBlock [] s es |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment