change printing of binders

old: (1 | 1 | x : A) ->
new: (x @ 1, 1 : A) ->
This commit is contained in:
rhiannon morris 2021-12-23 15:50:19 +01:00
parent d5530f9884
commit 40fde92823
2 changed files with 10 additions and 4 deletions

View File

@ -27,11 +27,16 @@ PrettyHL Qty where
One => ifUnicode "𝟭" "1"
Any => ifUnicode "𝛚" "*"
private
commas : List (Doc HL) -> List (Doc HL)
commas [] = []
commas [x] = [x]
commas (x::xs) = (x <+> hl Delim ",") :: commas xs
export %inline
prettyQtyBinds : Pretty.HasEnv m => List Qty -> m (Doc HL)
prettyQtyBinds =
map (align . sep) .
traverse (\pi => [|pretty0M pi <++> pure (hl Delim "|")|])
map ((hl Delim "@" <++>) . align . sep . commas) . traverse pretty0M
public export

View File

@ -172,8 +172,9 @@ mutual
prettyBinder : Pretty.HasEnv m => List Qty -> Name -> Term d n -> m (Doc HL)
prettyBinder pis x a =
pure $ parens $ hang 2 $
!(prettyQtyBinds pis) <//>
hsep [hl TVar !(prettyM x), colonD, !(withPrec Outer $ prettyM a)]
hsep [hl TVar !(prettyM x),
sep [!(prettyQtyBinds pis),
hsep [colonD, !(withPrec Outer $ prettyM a)]]]
export FromVar (Elim d) where fromVar = B