Skip to content

refutable let bindings produce "irrefutable pattern failed" errors

In ghc-8.2.2 (probably since ghc-8.0.1), strict pattern matches in let bindings produce "Irrefutable pattern failed" errors.

GHCi, version 8.2.2: http://www.haskell.org/ghc/  :? for help
Prelude> :set -XBangPatterns 
Prelude> let ![] = [1] in 1
*** Exception: <interactive>:2:5-13: Irrefutable pattern failed for pattern []

In ghc-7.10.2, normal pattern match failures were produced.

GHCi, version 7.10.2: http://www.haskell.org/ghc/  :? for help
Prelude> :set -XBangPatterns 
Prelude> let ![] = [1] in 1
*** Exception: <interactive>:3:5-13: Non-exhaustive patterns in pattern binding

To my mind, the latter error makes much more sense; the effect of the ! is to make the pattern an ordinary, refutable one. Could the old behavior be restored?

Trac metadata
Trac field Value
Version 8.2.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information