summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2014-03-10 21:36:07 +1100
committerJed Barber <jjbarber@y7mail.com>2014-03-10 21:36:07 +1100
commitea5647fe44731865726d910973dcc58d83ad6cc5 (patch)
tree2e5c37498f8c9f34df68edbbeb2ef1acb92532ac
parentfe38d7ca73bc552ea4e46ec24ce668030698e2f5 (diff)
UnlambdaTerms now Show correctly
-rw-r--r--Unlambda/Interpreter.hs2
-rw-r--r--Unlambda/Parser.hs23
2 files changed, 21 insertions, 4 deletions
diff --git a/Unlambda/Interpreter.hs b/Unlambda/Interpreter.hs
index e5a442b..c9820f0 100644
--- a/Unlambda/Interpreter.hs
+++ b/Unlambda/Interpreter.hs
@@ -77,5 +77,3 @@ apply firstTerm secondTerm =
Compare c -> return I --placeholder
- Continuation cont -> return I --placeholder
-
diff --git a/Unlambda/Parser.hs b/Unlambda/Parser.hs
index 7e578ad..948211d 100644
--- a/Unlambda/Parser.hs
+++ b/Unlambda/Parser.hs
@@ -19,9 +19,28 @@ data UnlambdaTerm = S | K | I | V | R | D | C | E | Bar | Reed
| Kpartial UnlambdaTerm
| Spartial UnlambdaTerm
| Sapp UnlambdaTerm UnlambdaTerm
- | Continuation UnlambdaTerm
| Promise UnlambdaTerm
- deriving (Eq, Show)
+ deriving (Eq)
+
+
+instance Show UnlambdaTerm where
+ show S = "s"
+ show K = "k"
+ show I = "i"
+ show V = "v"
+ show R = "r"
+ show D = "d"
+ show C = "c"
+ show E = "e"
+ show Bar = "|"
+ show Reed = "@"
+ show (Dot x) = ['.', x]
+ show (Compare x) = ['?', x]
+ show (App x y) = "`" ++ (show x) ++ (show y)
+ show (Kpartial x) = "`k" ++ (show x)
+ show (Spartial x) = "`s" ++ (show x)
+ show (Sapp x y) = "``s" ++ (show x) ++ (show y)
+ show (Promise x) = "`d" ++ (show x)