
#13600: surprising error message with bang pattern -------------------------------------+------------------------------------- Reporter: andrewufrank | Owner: v0d1ch Type: bug | Status: closed Priority: normal | Milestone: 8.8.1 Component: Compiler | Version: 8.0.2 Resolution: fixed | Keywords: BangPatterns, | newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Poor/confusing | Test Case: T13600a, error message | T13600b Blocked By: | Blocking: Related Tickets: #15166, #15458 | Differential Rev(s): Phab:D5040 Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): My apologies -- I should have looked at the Phab earlier. Would it be possible to add a Note to explain what is happening in the code, perhaps near `Passer.warnSpaceAfterBang`. I believe that the specification is this: -------- GHC warns if it sees * A infix definition of `(!)` * that lacks a space before the `!` operator That is, something like {{{ x !p = e }}} where `p` is a pattern. If `BangPatterns` are on, this example would be treated as a definition of the function `x` applied the to the bang-pattern `!p`. If there is a space after the bang, thus {{{ x ! p = e }}} then the definition is treated as a definition of `(!)` (without `BangPatterns`) or as `x (!p) = e` (with `BangPatterns`), with no warning in either case. ------------ Is that the correct specification? If so, it'd be good to explain this in the user manual, and in the Note in the code. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13600#comment:20 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler