summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCamil Staps2016-03-12 11:56:25 +0100
committerCamil Staps2016-03-12 11:56:25 +0100
commit1b1f952e8169e99532f663305100b2b37d55f46c (patch)
tree0734e8c40d8de40872aeb1705dec2683278272a8
parentmkworld (diff)
restricted existentially qualified type
-rw-r--r--restricted_exisential_type.icl14
1 files changed, 14 insertions, 0 deletions
diff --git a/restricted_exisential_type.icl b/restricted_exisential_type.icl
new file mode 100644
index 0000000..0e0bff8
--- /dev/null
+++ b/restricted_exisential_type.icl
@@ -0,0 +1,14 @@
+module restricted_existential_type
+
+import StdString
+
+:: List = Nil
+ | E.e: Cons e List & toString e
+
+instance toString List
+where
+ toString Nil = "[]"
+ toString (Cons e l) = "["+++toString e+++":"+++toString l+++"]"
+
+Start = toString (Cons 'a' (Cons 5 Nil))
+