[GHC] #14569: refutable let bindings produce "irrefutable pattern failed" errors

GHC ghc-devs at haskell.org
Mon Dec 11 11:43:37 UTC 2017


#14569: refutable let bindings produce "irrefutable pattern failed" errors
-------------------------------------+-------------------------------------
        Reporter:  int-e             |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Poor/confusing    |  Unknown/Multiple
  error message                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 I rather agree.  Actually even 7.10 had this behaviour.  Try
 {{{
 main = let [x] = []
        in print (x::Int)
 }}}
 and you get the runtime crash (with 7.10)
 {{{
 run: T14569.hs:3:12-19: Irrefutable pattern failed for pattern [x]
 }}}
 The real point is: this talk of "irrefutable" patterns is confusing,
 especially since this one is manifestly refutable.

 Suggestion: uniformly replace the "Irrefutable pattern failed" message
 with "Non-exhaustive patterns in pattern binding".

 To do this

 * Kill off `Control.Exception.Base.irrefutPatError`
 * Kill off `MkCore.iRREFUT_PAT_ERROR_ID` and its `Name`, unique, etc.
 * Use `pAT_ERROR_ID` wherever we currently use `iRREFUT_PAT_ERROR_ID`.

 Ben, if everyone is happy, would you like to execute on this?

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14569#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list