1
1
mirror of https://github.com/github/semantic.git synced 2024-11-28 01:47:01 +03:00

Correct the precedence of if/then/else and lambda.

This commit is contained in:
Rob Rix 2019-07-23 15:12:41 -04:00
parent 9ccd11ef09
commit 068941e3e1
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7

View File

@ -54,8 +54,8 @@ prettyCore style = precBody . go . fmap name
, symbol "=" <+> align (withPrec 0 (go (instantiate1 (pure (name x)) b)))
]
Lam (Named (Ignored x) b) -> prec 0 . group . nest 2 $ vsep
[ lambda <> name x, arrow <+> withPrec 0 (go (instantiate1 (pure (name x)) b)) ]
Lam (Named (Ignored x) b) -> prec 3 . group . nest 2 $ vsep
[ lambda <> name x, arrow <+> withPrec 3 (go (instantiate1 (pure (name x)) b)) ]
Record fs -> atom . group . nest 2 $ vsep [ primitive "record", block ", " (map (uncurry keyValue) fs) ]
@ -65,7 +65,7 @@ prettyCore style = precBody . go . fmap name
f :$ x -> prec 8 (withPrec 8 (go f) <+> withPrec 9 (go x))
If con tru fal -> prec 8 . group $ vsep
If con tru fal -> prec 3 . group $ vsep
[ keyword "if" <+> precBody (go con)
, keyword "then" <+> precBody (go tru)
, keyword "else" <+> precBody (go fal)