add enums, which also need whnf to be fallible :(
This commit is contained in:
parent
0e481a8098
commit
efca9a7138
11 changed files with 269 additions and 64 deletions
|
@ -85,6 +85,11 @@ prettyCase pi elim r ret arms =
|
|||
hsep [returnD, !(prettyM r), !darrowD, !(under T r $ prettyM ret)],
|
||||
hsep [ofD, !(prettyArms arms)]]
|
||||
|
||||
-- [fixme] put delimiters around tags that aren't simple names
|
||||
export
|
||||
prettyTag : TagVal -> Doc HL
|
||||
prettyTag t = hl Tag $ "`" <+> fromString t
|
||||
|
||||
|
||||
mutual
|
||||
export covering
|
||||
|
@ -101,6 +106,10 @@ mutual
|
|||
prettyM (Pair s t) =
|
||||
let GotPairs {init, last, _} = getPairs t in
|
||||
prettyTuple $ s :: init ++ [last]
|
||||
prettyM (Enum tags) =
|
||||
pure $ braces . aseparate comma $ map prettyTag $ Prelude.toList tags
|
||||
prettyM (Tag t) =
|
||||
pure $ prettyTag t
|
||||
prettyM (Eq (S _ (N ty)) l r) =
|
||||
parensIfM Eq !(withPrec InEq $ pure $
|
||||
sep [!(prettyM l) <++> !eqndD,
|
||||
|
@ -137,6 +146,9 @@ mutual
|
|||
pat <- (parens . separate commaD . map (hl TVar)) <$>
|
||||
traverse prettyM [x, y]
|
||||
prettyCase pi p r ret [([x, y], pat, body)]
|
||||
prettyM (CaseEnum pi t (S [r] ret) arms) =
|
||||
prettyCase pi t r ret
|
||||
[([], prettyTag t, b) | (t, b) <- SortedMap.toList arms]
|
||||
prettyM (e :% d) =
|
||||
let GotDArgs {fun, args, _} = getDArgs' e [d] in
|
||||
prettyApps fun args
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue