Add a comment to Pretty.hs
This commit is contained in:
parent
bb0e0d987c
commit
61bf676cbf
|
@ -158,7 +158,12 @@ prettyNix = withoutParens . cata phi where
|
|||
phi (NAbs args body) = leastPrecedence $
|
||||
nest 2 ((prettyParams args <> colon) <$> withoutParens body)
|
||||
phi (NBinary NApp fun arg)
|
||||
= NixDoc (wrapParens appOp fun <+> wrapParens appOpNonAssoc arg) appOp
|
||||
-- jww (2018-04-19): If 'arg' was a binary operator, it will not have
|
||||
-- parens itself, and yet its precedence is very likely to be lower than
|
||||
-- function application. However, we've lost the knowledge of whether it
|
||||
-- should or shouldn't be surrounded by parens, so we do it always for
|
||||
-- now.
|
||||
= NixDoc (wrapParens appOp fun <+> parens (withoutParens arg)) appOp
|
||||
phi (NBinary op r1 r2) = flip NixDoc opInfo $ hsep
|
||||
[ wrapParens (f NAssocLeft) r1
|
||||
, text $ unpack $ operatorName opInfo
|
||||
|
|
Loading…
Reference in a new issue