summaryrefslogtreecommitdiff
path: root/assignment-12/gastje.icl
diff options
context:
space:
mode:
Diffstat (limited to 'assignment-12/gastje.icl')
-rw-r--r--assignment-12/gastje.icl25
1 files changed, 11 insertions, 14 deletions
diff --git a/assignment-12/gastje.icl b/assignment-12/gastje.icl
index 09fe76e..06148cf 100644
--- a/assignment-12/gastje.icl
+++ b/assignment-12/gastje.icl
@@ -87,24 +87,21 @@ where
rev [] accu = accu
rev [x:r] accu = rev r [x:accu]
-:: For t = E.p: (For) infix 0 (t -> p) [t] & prop p
-
-instance prop (For t) | string{|*|} t
+/**
+ * TODO: mixing deep and shallow embedding. This is not how this is supposed to
+ * be done. These can be plain functions or classes.
+ */
+:: Property
+ = E.p t: (For) infix 0 (t -> p) [t] & prop p & string{|*|} t
+ | E.p: (==>) infix 0 Bool p & prop p
+ | E.t: (=.=) infix 4 t t & ==, string{|*|} t
+
+instance prop Property
where
holds (f For xs) p = diagonal [holds (f x) {p & info=[string{|*|} x:p.info]} \\ x <- xs]
-
-:: Implies = E.p: (==>) infix 0 Bool p & prop p
-
-instance prop Implies
-where
holds (True ==> t) p = holds t p
holds (False ==> _) p = []
-
-:: Equals a = (=.=) infix 4 a a
-
-instance prop (Equals a) | ==, string{|*|} a
-where
- holds (x =.= y) p = [{bool=x==y, info=[string{|*|} x," <> ",string{|*|} y,"; ":p.info]}]
+ holds (x =.= y) p = [{bool=x==y, info=[string{|*|} y," <> ",string{|*|} x,"; ":p.info]}]
Start =
[ ["pUpper: ":test (pUpper For ['a'..'z'])]