]> gerrit.simantics Code Review - simantics/platform.git/blob - tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/RecordWildcards.scl
Fixed record constructor resolving from namespaces
[simantics/platform.git] / tests / org.simantics.scl.compiler.tests / src / org / simantics / scl / compiler / tests / scl / RecordWildcards.scl
1 import "Prelude"
2
3 data XYZ = XYZ { x :: Double, y :: Double, z :: Double }
4 deriving instance Show XYZ
5
6 updateX x' XYZ {..} = XYZ {x', ..} 
7
8 main = print $ updateX 5 $ XYZ { x = 4, y = 3, .. }
9   where
10     z = 2
11 -- 
12 XYZ 5.0 3.0 2.0
13 ()
14 --
15 import "Prelude"
16
17 main = ()
18   where
19     constraint R { a :: Integer, b :: Integer, label :: String }
20     
21     -R { a = 0, ..   } => print "Final: b = \(?b), label = \(?label)"
22     -R { ?a,  ?b, .. } => R { a=?a-1, b=?b+1, .. }
23     
24     True => R { a = 5, b = 5, label = "My label" } 
25 --
26 Final: b = 10, label = My label
27 ()