summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/LambdaCube/Compiler/Patterns.hs22
-rw-r--r--src/LambdaCube/Compiler/Pretty.hs1
2 files changed, 12 insertions, 11 deletions
diff --git a/src/LambdaCube/Compiler/Patterns.hs b/src/LambdaCube/Compiler/Patterns.hs
index 856de00d..3056b132 100644
--- a/src/LambdaCube/Compiler/Patterns.hs
+++ b/src/LambdaCube/Compiler/Patterns.hs
@@ -85,20 +85,20 @@ pattern PConSimp n ps = ParPat [PCon n ps]
85pattern ViewPatSimp e p = ParPat [ViewPat e p] 85pattern ViewPatSimp e p = ParPat [ViewPat e p]
86pattern PatTypeSimp p t = ParPat [PatType p t] 86pattern PatTypeSimp p t = ParPat [PatType p t]
87 87
88pBuiltin_ n ci ps = PConSimp (n, left (second $ map $ first f) ci) ps 88pBuiltin_ n ci ps = PConSimp (n, ci) ps
89 where 89pBuiltin n = pBuiltin_ (consName n)
90 f n = SIName (debugSI $ "pattern_" ++ n) n 90
91pBuiltin n = pBuiltin_ (SIName (debugSI $ "Constructor_" ++ n) n) 91consName n = SIName (debugSI $ "Constructor_" ++ n) n
92 92
93cTrue = pBuiltin "True" (Left ((CaseName "'Bool", 0), [("False", 0), ("True", 0)])) [] 93cTrue = pBuiltin "True" (Left ((CaseName "'Bool", 0), [(consName "False", 0), (consName "True", 0)])) []
94cZero = pBuiltin "Zero" (Left ((CaseName "'Nat", 0), [("Zero", 0), ("Succ", 1)])) [] 94cZero = pBuiltin "Zero" (Left ((CaseName "'Nat", 0), [(consName "Zero", 0), (consName "Succ", 1)])) []
95cNil = pBuiltin "Nil" (Left ((CaseName "'List", 0), [("Nil", 0), (":", 2)])) [] 95cNil = pBuiltin "Nil" (Left ((CaseName "'List", 0), [(consName "Nil", 0), (ConsName, 2)])) []
96cHNil = pBuiltin "HNil" (Left (("hlistNilCase", -1), [("HNil", 0)])) [] 96cHNil = pBuiltin "HNil" (Left (("hlistNilCase", -1), [(consName "HNil", 0)])) []
97cList a = pBuiltin "'List" (Right 1) [a] 97cList a = pBuiltin "'List" (Right 1) [a]
98cHList a = pBuiltin "'HList" (Right 1) [a] 98cHList a = pBuiltin "'HList" (Right 1) [a]
99cSucc a = pBuiltin "Succ" (Left ((CaseName "'Nat", 0), [("Zero", 0), ("Succ", 1)])) [a] 99cSucc a = pBuiltin "Succ" (Left ((CaseName "'Nat", 0), [(consName "Zero", 0), (consName "Succ", 1)])) [a]
100cCons a b = pBuiltin_ ConsName (Left ((CaseName "'List", 0), [("Nil", 0), (":", 2)])) [a, b] 100cCons a b = pBuiltin_ ConsName (Left ((CaseName "'List", 0), [(consName "Nil", 0), (ConsName, 2)])) [a, b]
101cHCons a b = pBuiltin "HCons" (Left (("hlistConsCase", -1), [("HCons", 2)])) [a, b] 101cHCons a b = pBuiltin "HCons" (Left (("hlistConsCase", -1), [(consName "HCons", 2)])) [a, b]
102 102
103pattern PParens p = ViewPatSimp (SBuiltin "parens") p 103pattern PParens p = ViewPatSimp (SBuiltin "parens") p
104 104
diff --git a/src/LambdaCube/Compiler/Pretty.hs b/src/LambdaCube/Compiler/Pretty.hs
index e7047a7e..6a80da1f 100644
--- a/src/LambdaCube/Compiler/Pretty.hs
+++ b/src/LambdaCube/Compiler/Pretty.hs
@@ -198,6 +198,7 @@ renderDoc
198 render = snd . render' 198 render = snd . render'
199 where 199 where
200 render' = \case 200 render' = \case
201 DText "Nil" -> rtext "[]"
201 DAtom x -> renderA x 202 DAtom x -> renderA x
202 DFormat c x -> second c $ render' x 203 DFormat c x -> second c $ render' x
203 DDocOp f d -> (('\0', '\0'), f $ render <$> d) 204 DDocOp f d -> (('\0', '\0'), f $ render <$> d)