]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/scl/ExistentialData.scl
Ensure GetElementClassRequest is not constructed without elementFactory
[simantics/platform.git] / bundles / org.simantics.scl.compiler / tests / org / simantics / scl / compiler / tests / scl / ExistentialData.scl
1 import "JavaBuiltin" as Java\r
2 \r
3 (+) = Java.iadd\r
4 \r
5 data Thunk a = /* forall s. */ Thunk s (s -> a)\r
6 \r
7 id :: a -> a\r
8 id x = x\r
9 \r
10 runThunk :: Thunk a -> a\r
11 runThunk (Thunk s f) = f s\r
12 \r
13 makeThunk :: a -> Thunk a\r
14 makeThunk x = Thunk x id\r
15 \r
16 mapThunk :: (a -> b) -> Thunk a -> Thunk b\r
17 mapThunk f (Thunk s g) = Thunk s (\x -> f (g x))\r
18 \r
19 a = makeThunk (13 :: Integer)\r
20 b = mapThunk (\x -> x+1) a\r
21 main = runThunk b\r
22 --\r
23 14