]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/scl/Macros3.scl
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.scl.compiler / tests / org / simantics / scl / compiler / tests / scl / Macros3.scl
diff --git a/bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/scl/Macros3.scl b/bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/scl/Macros3.scl
new file mode 100644 (file)
index 0000000..ec1571d
--- /dev/null
@@ -0,0 +1,16 @@
+import "JavaBuiltin" as Java\r
+\r
+@JavaType "java.util.Collection"\r
+data Collection a\r
+\r
+@macro\r
+collectionToList :: Collection a -> [a]\r
+collectionToList = Java.unsafeCoerce\r
+\r
+singleton :: a -> Collection a\r
+singleton = Java.staticMethod "java.util.Collections.singletonList"\r
+\r
+main :: [Integer]\r
+main = collectionToList (singleton 15)\r
+--\r
+[15]
\ No newline at end of file