X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=tests%2Forg.simantics.scl.compiler.tests%2Fsrc%2Forg%2Fsimantics%2Fscl%2Fcompiler%2Ftests%2Fscl%2FExistentialData.scl;h=7cb6873333972c9651db1630e06ca36a1dd83468;hp=62130b49f5388a465903827fe9635edd7cdb613b;hb=172abed5dbf73c1304a7a95bb8504ea293556948;hpb=0364f8f54b009e9e5de482d5c9d1cb7efb023141 diff --git a/tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/ExistentialData.scl b/tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/ExistentialData.scl index 62130b49f..7cb687333 100644 --- a/tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/ExistentialData.scl +++ b/tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/ExistentialData.scl @@ -1,23 +1,23 @@ -import "JavaBuiltin" as Java - -(+) = Java.iadd - -data Thunk a = /* forall s. */ Thunk s (s -> a) - -id :: a -> a -id x = x - -runThunk :: Thunk a -> a -runThunk (Thunk s f) = f s - -makeThunk :: a -> Thunk a -makeThunk x = Thunk x id - -mapThunk :: (a -> b) -> Thunk a -> Thunk b -mapThunk f (Thunk s g) = Thunk s (\x -> f (g x)) - -a = makeThunk (13 :: Integer) -b = mapThunk (\x -> x+1) a -main = runThunk b --- +import "JavaBuiltin" as Java + +(+) = Java.iadd + +data Thunk a = /* forall s. */ Thunk s (s -> a) + +id :: a -> a +id x = x + +runThunk :: Thunk a -> a +runThunk (Thunk s f) = f s + +makeThunk :: a -> Thunk a +makeThunk x = Thunk x id + +mapThunk :: (a -> b) -> Thunk a -> Thunk b +mapThunk f (Thunk s g) = Thunk s (\x -> f (g x)) + +a = makeThunk (13 :: Integer) +b = mapThunk (\x -> x+1) a +main = runThunk b +-- 14 \ No newline at end of file