
#9127: Don't warn about pattern-bindings of the form `let !_ = rhs` -------------------------------------+------------------------------------ Reporter: refold | Owner: gzayas Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Comment (by simonpj): I'd love to see this documented in the user manual, please. Look at [http://www.haskell.org/ghc/docs/latest/html/users_guide/options- sanity.html sanity checking] and `-fwarn-unused-bindings`. There are really two things enabled by `-fwarn-unused_bindings`: * Warning about a named variable brought into scope but not used (unless exported or starting with underscore). e.g. {{{ let f x = rhs1 in True -- Warning for unused f let (p,q) = rhs2 in p+1 -- Warning about unused q }}} * Warning about a pattern binding that doesn't bind anything; e.g. {{{ Just _ = rhs1 -- Warning for unused binding (_, _) = rhs2 -- Warning for unused binding }}} But no warning is given for a lone wild-card pattern or banged wild-card pattern: {{{ _ = rhs3 -- No warning !_ = rhs4 -- No warning; behaves like seq }}} The former is not very different from `_v = rhs3` which elicits no warning; and can be useful to add a type constraint, e.g. `_ = x::Int`. The latter is useful as an alternative way to force evaluation. Could you add all that to the manual? Thanks -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9127#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler