mirror of
https://github.com/unisonweb/unison.git
synced 2024-10-04 21:57:25 +03:00
term printing tweaks
This commit is contained in:
parent
58e8f928c2
commit
ca1f9d69a9
@ -114,7 +114,10 @@ pickName r h = case argmax snd (Map.toList h) of
|
||||
|
||||
pickNameReferent :: Referent -> Histogram -> Name
|
||||
pickNameReferent r h = case argmax snd (Map.toList h) of
|
||||
Nothing -> Text.pack (show r)
|
||||
Nothing -> case r of
|
||||
Names.Ref r -> Text.pack (show r)
|
||||
Names.Con r i -> Text.pack (show r <> "#" <> show i)
|
||||
Names.Req r i -> Text.pack (show r <> "#" <> show i)
|
||||
Just (name,_) -> name
|
||||
|
||||
pickNameCid :: Reference -> Int -> Histogram -> Name
|
||||
|
@ -112,7 +112,7 @@ pretty n p term = specialCases term $ \case
|
||||
<> PP.Nest " " (PP.Group (pretty n 2 body))
|
||||
App' x (Constructor' Type.UnitRef 0) -> paren (p >= 11) $ l"!" <> pretty n 11 x
|
||||
LamNamed' v x | (Var.name v) == "()" -> paren (p >= 11) $ l"'" <> pretty n 11 x
|
||||
Vector' xs -> PP.Nest " " $ PP.Group $ l"[" <> commaList (toList xs) <> l"]"
|
||||
Vector' xs -> PP.Group $ l"[" <> intercalateMap ("," <> b" ") (PP.Nest " " . pretty n 0) (toList xs) <> l"]"
|
||||
If' cond t f -> parenNest (p >= 2) $
|
||||
(PP.Group (l"if" <> b" " <> pretty n 2 cond) <> b" " <>
|
||||
PP.Group (l"then" <> b" " <> pretty n 2 t) <> b" " <>
|
||||
|
Loading…
Reference in New Issue
Block a user