]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/scl/RecordShorthand.scl
migrated to svn revision 33108
[simantics/platform.git] / bundles / org.simantics.scl.compiler / tests / org / simantics / scl / compiler / tests / scl / RecordShorthand.scl
diff --git a/bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/scl/RecordShorthand.scl b/bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/scl/RecordShorthand.scl
new file mode 100644 (file)
index 0000000..d3af73e
--- /dev/null
@@ -0,0 +1,11 @@
+import "Prelude"
+
+data Vec = Vec { x :: Double, y :: Double }
+deriving instance Show Vec
+
+createVec x y = Vec {x, y}
+sumVec Vec { x1, y1 } Vec { x2, y2 } = Vec { x = x1+x2, y = y1 + y2 }
+
+main = sumVec (createVec 1 2) (createVec 3 4)
+-- 
+(Vec 4.0 6.0)
\ No newline at end of file