
#13637: Printing type operators adds extraneous parenthesis -------------------------------------+------------------------------------- Reporter: darchon | Owner: alanz Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1-rc2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by harpocrates): This seems to be by design. Taken from `BasicTypes`: {{{ Note [Type operator precedence] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ We don't keep the fixity of type operators in the operator. So the pretty printer follows the following precedence order: TyConPrec Type constructor application TyOpPrec/FunPrec Operator application and function arrow We have FunPrec and TyOpPrec to represent the precedence of function arrow and type operators respectively, but currently we implement FunPred == TyOpPrec, so that we don't distinguish the two. Reason: it's hard to parse a type like a ~ b => c * d -> e - f By treating TyOpPrec = FunPrec we end up with more parens (a ~ b) => (c * d) -> (e - f) But the two are different constructors of TyPrec so we could make (->) bind more or less tightly if we wanted. }}} I propose we close this ticket - I tend to agree with the note that the extra parens increase readability. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13637#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler