summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCamil Staps2016-04-13 08:38:07 +0200
committerCamil Staps2016-04-13 08:38:07 +0200
commitad5b169146f4f95e8d3bf750a43e1043e150d153 (patch)
tree9e459eee3e933cfde6407ddd5c0d1003ab213666
parentgitignore (diff)
Overloaded constructors
-rw-r--r--overloaded_constructors.icl11
1 files changed, 11 insertions, 0 deletions
diff --git a/overloaded_constructors.icl b/overloaded_constructors.icl
new file mode 100644
index 0000000..5d3adc8
--- /dev/null
+++ b/overloaded_constructors.icl
@@ -0,0 +1,11 @@
+module overloaded_constructors
+
+:: Tree a = Node a (Tree a) (Tree a) | TreeNil
+:: List a = Cons a (List a) | ListNil
+
+class Nil a :: a b
+instance Nil Tree where Nil = TreeNil
+instance Nil List where Nil = ListNil
+
+Start = Cons 5 Nil
+