Skip to content

GHCi crashes if a :def command gets a pattern-match error

Peter Hercek reports

% ghci
GHCi, version 6.10.1: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer ... linking ... done.
Loading package base ... linking ... done.
Prelude> :def err (\_->return $ concat $ replicate (read "\"1\"") "a")
Prelude> :err
ghc: panic! (the 'impossible' happened)
   (GHC version 6.10.1 for i386-unknown-linux):
        Prelude.read: no parse

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

The "no parse" is quite correct: (read "\"1\"") :: Int should fail to parse. But it's wrong that a crashing :def should crash out of GHCi. Rather it should just return to the prompt, preferably with a failure message saying that running a :def failed.

Simon

Trac metadata
Trac field Value
Version 6.10.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