diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/LambdaCube/Compiler/Patterns.hs | 22 | ||||
-rw-r--r-- | src/LambdaCube/Compiler/Pretty.hs | 1 |
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] | |||
85 | pattern ViewPatSimp e p = ParPat [ViewPat e p] | 85 | pattern ViewPatSimp e p = ParPat [ViewPat e p] |
86 | pattern PatTypeSimp p t = ParPat [PatType p t] | 86 | pattern PatTypeSimp p t = ParPat [PatType p t] |
87 | 87 | ||
88 | pBuiltin_ n ci ps = PConSimp (n, left (second $ map $ first f) ci) ps | 88 | pBuiltin_ n ci ps = PConSimp (n, ci) ps |
89 | where | 89 | pBuiltin n = pBuiltin_ (consName n) |
90 | f n = SIName (debugSI $ "pattern_" ++ n) n | 90 | |
91 | pBuiltin n = pBuiltin_ (SIName (debugSI $ "Constructor_" ++ n) n) | 91 | consName n = SIName (debugSI $ "Constructor_" ++ n) n |
92 | 92 | ||
93 | cTrue = pBuiltin "True" (Left ((CaseName "'Bool", 0), [("False", 0), ("True", 0)])) [] | 93 | cTrue = pBuiltin "True" (Left ((CaseName "'Bool", 0), [(consName "False", 0), (consName "True", 0)])) [] |
94 | cZero = pBuiltin "Zero" (Left ((CaseName "'Nat", 0), [("Zero", 0), ("Succ", 1)])) [] | 94 | cZero = pBuiltin "Zero" (Left ((CaseName "'Nat", 0), [(consName "Zero", 0), (consName "Succ", 1)])) [] |
95 | cNil = pBuiltin "Nil" (Left ((CaseName "'List", 0), [("Nil", 0), (":", 2)])) [] | 95 | cNil = pBuiltin "Nil" (Left ((CaseName "'List", 0), [(consName "Nil", 0), (ConsName, 2)])) [] |
96 | cHNil = pBuiltin "HNil" (Left (("hlistNilCase", -1), [("HNil", 0)])) [] | 96 | cHNil = pBuiltin "HNil" (Left (("hlistNilCase", -1), [(consName "HNil", 0)])) [] |
97 | cList a = pBuiltin "'List" (Right 1) [a] | 97 | cList a = pBuiltin "'List" (Right 1) [a] |
98 | cHList a = pBuiltin "'HList" (Right 1) [a] | 98 | cHList a = pBuiltin "'HList" (Right 1) [a] |
99 | cSucc a = pBuiltin "Succ" (Left ((CaseName "'Nat", 0), [("Zero", 0), ("Succ", 1)])) [a] | 99 | cSucc a = pBuiltin "Succ" (Left ((CaseName "'Nat", 0), [(consName "Zero", 0), (consName "Succ", 1)])) [a] |
100 | cCons a b = pBuiltin_ ConsName (Left ((CaseName "'List", 0), [("Nil", 0), (":", 2)])) [a, b] | 100 | cCons a b = pBuiltin_ ConsName (Left ((CaseName "'List", 0), [(consName "Nil", 0), (ConsName, 2)])) [a, b] |
101 | cHCons a b = pBuiltin "HCons" (Left (("hlistConsCase", -1), [("HCons", 2)])) [a, b] | 101 | cHCons a b = pBuiltin "HCons" (Left (("hlistConsCase", -1), [(consName "HCons", 2)])) [a, b] |
102 | 102 | ||
103 | pattern PParens p = ViewPatSimp (SBuiltin "parens") p | 103 | pattern 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) |