reprime when printing types
This commit is contained in:
parent
0e62924aaf
commit
7c19935d86
2 changed files with 6 additions and 3 deletions
|
@ -2,6 +2,7 @@
|
|||
module Type.PrettyPrint where
|
||||
|
||||
import Text.PrettyPrint
|
||||
import qualified SourceSyntax.PrettyPrint as Src
|
||||
|
||||
data ParensWhen = Fn | App | Never
|
||||
|
||||
|
@ -10,4 +11,6 @@ class PrettyType a where
|
|||
|
||||
commaSep docs = sep (punctuate comma docs)
|
||||
|
||||
parensIf bool doc = if bool then parens doc else doc
|
||||
parensIf bool doc = if bool then parens doc else doc
|
||||
|
||||
reprime = Src.reprime
|
|
@ -176,7 +176,7 @@ instance PrettyType a => PrettyType (Term1 a) where
|
|||
prettyExt = prty ext
|
||||
extend | P.render prettyExt == "{}" = P.empty
|
||||
| otherwise = prettyExt <+> P.text "|"
|
||||
mkPretty f t = P.text f <+> P.text ":" <+> prty t
|
||||
mkPretty f t = P.text (reprime f) <+> P.text ":" <+> prty t
|
||||
prettyFields = concatMap (\(f,ts) -> map (mkPretty f) ts) (Map.toList fields)
|
||||
|
||||
|
||||
|
@ -191,7 +191,7 @@ instance PrettyType Descriptor where
|
|||
pretty when desc =
|
||||
case (structure desc, name desc) of
|
||||
(Just term, _) -> pretty when term
|
||||
(_, Just name) -> if not (isTuple name) then P.text name else
|
||||
(_, Just name) -> if not (isTuple name) then P.text (reprime name) else
|
||||
P.parens . P.text $ replicate (read (drop 6 name) - 1) ','
|
||||
_ -> P.text "?"
|
||||
|
||||
|
|
Loading…
Reference in a new issue