Created
April 18, 2015 20:15
-
-
Save trillioneyes/4131e9d4ad7c947adf04 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
-- λΠ> run $ the (SideEffect FFI_JS ()) (run yieldDemo) | |
io_bind (io_bind (MkIO (\w => | |
mkForeignPrim (JS_Str, "red") w "setColor(%0)" JS_Unit)) | |
(\ {bindx9} => | |
MkIO (\w => | |
mkForeignPrim (JS_IntT JS_IntNative, 50) | |
(JS_IntT JS_IntNative, 50) | |
(JS_IntT JS_IntNative, 0) | |
(JS_IntT JS_IntNative, 0) | |
w | |
"rect(%0, %1, %2, %3)" | |
JS_Unit))) | |
(\v => | |
MkIO (\w => | |
mkForeignPrim (JS_FnT (JS_Fn JS_Float (JS_FnIO JS_Unit)), | |
MkJsFn (\timeOffset => | |
MkIO (\w => | |
mkForeignPrim (JS_FnT (JS_Fn JS_Float | |
(JS_FnIO JS_Unit)), | |
MkJsFn (\timeOffset => | |
io_bind (io_bind (MkIO (\w => | |
mkForeignPrim (JS_Str, | |
"blue") | |
w | |
"setColor(%0)" | |
JS_Unit)) | |
(\ {bindx9} => | |
MkIO (\w => | |
mkForeignPrim (JS_IntT JS_IntNative, | |
50) | |
(JS_IntT JS_IntNative, | |
50) | |
(JS_IntT JS_IntNative, | |
25) | |
(JS_IntT JS_IntNative, | |
0) | |
w | |
"rect(%0, %1, %2, %3)" | |
JS_Unit))) | |
(\v => | |
io_bind (io_bind (MkIO (\w => | |
mkForeignPrim (JS_Str, | |
"green") | |
w | |
"setColor(%0)" | |
JS_Unit)) | |
(\ {bindx9} => | |
MkIO (\w => | |
mkForeignPrim (JS_IntT JS_IntNative, | |
50) | |
(JS_IntT JS_IntNative, | |
50) | |
(JS_IntT JS_IntNative, | |
prim__fromFloatInt (prim__floatFloor (prim__subFloat timeOffset | |
timeOffset))) | |
(JS_IntT JS_IntNative, | |
200) | |
w | |
"rect(%0, %1, %2, %3)" | |
JS_Unit))) | |
(\v => | |
io_return ())))) | |
w | |
"requestAnimationFrame(%0)" | |
JS_Unit))) | |
w | |
"requestAnimationFrame(%0)" | |
JS_Unit)) : IO' (MkFFI JS_Types String String) () |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment