pprint universes as a direct suffix
in subscript in unicode mode
This commit is contained in:
parent
fbfbe57266
commit
82a2f92ddf
2 changed files with 12 additions and 1 deletions
|
@ -94,7 +94,7 @@ mutual
|
|||
export covering
|
||||
PrettyHL q => PrettyHL (Term q d n) where
|
||||
prettyM (TYPE l) =
|
||||
parensIfM App $ !typeD <//> !(withPrec Arg $ prettyM l)
|
||||
parensIfM App $ !typeD <+> hl Syntax !(prettyUnivSuffix l)
|
||||
prettyM (Pi qty s (S [x] t)) =
|
||||
prettyBindType [qty] x s !arrowD t
|
||||
prettyM (Lam (S x t)) =
|
||||
|
|
|
@ -22,6 +22,17 @@ PrettyHL Universe where
|
|||
prettyM UAny = pure $ hl Delim "_"
|
||||
prettyM (U l) = pure $ hl Free $ pretty l
|
||||
|
||||
export
|
||||
prettyUnivSuffix : Pretty.HasEnv m => Universe -> m (Doc HL)
|
||||
prettyUnivSuffix UAny = ifUnicode "_" "₋"
|
||||
prettyUnivSuffix (U l) =
|
||||
ifUnicode (pretty $ pack $ map sub $ unpack $ show l) (pretty l)
|
||||
where
|
||||
sub : Char -> Char
|
||||
sub c = case c of
|
||||
'0' => '₀'; '1' => '₁'; '2' => '₂'; '3' => '₃'; '4' => '₄'
|
||||
'5' => '₅'; '6' => '₆'; '7' => '₇'; '8' => '₈'; '9' => '₉'; _ => c
|
||||
|
||||
export %inline
|
||||
fromInteger : (x : Integer) -> (0 _ : So (x >= 0)) => Universe
|
||||
fromInteger x = U $ fromInteger x
|
||||
|
|
Loading…
Reference in a new issue