]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/scl/FoldlBuild1.scl
Ensure GetElementClassRequest is not constructed without elementFactory
[simantics/platform.git] / bundles / org.simantics.scl.compiler / tests / org / simantics / scl / compiler / tests / scl / FoldlBuild1.scl
1 import "Prelude"\r
2 \r
3 inc :: Ref Integer -> <Proc> Integer\r
4 inc r = do \r
5     v = getRef r\r
6     newV = v+1\r
7     r := newV\r
8     newV\r
9 \r
10 main = do\r
11     r = ref 0\r
12     // Because both map and for get side-effectful functions\r
13     // as parameters, the fusion is not allowed.\r
14     l = map (\_ -> inc r) [1..4]    \r
15     for l (\i -> r := i+1)\r
16     getRef r\r
17 --\r
18 5\r