Skip to content

GHCi debugger crashes with :print

To reproduce:

  1. Enter the following code into a source file:
{-# LANGUAGE NoMonomorphismRestriction #-}

d (i, j) = i + j

dmerge xs     [] = xs
dmerge []     ys = ys
dmerge (x:xs) (y:ys) | d x <  d y = x : dmerge xs     (y:ys)
                     | d x == d y = x : dmerge xs     ys
                     | otherwise  = y : dmerge (x:xs) ys

pairs xs = head xs : pairs (tail xs `dmerge` map (\(i,j) -> (i+1,j+1)) xs
                                    `dmerge` map (\(i,j) -> (i,  j+1)) xs)

allpairs = pairs [(1,2)]
  1. Start ghci, and pass this file as a parameter.
  2. Type :print allpairs

GHCi will crash.

cdsmith@devtools:~/haskell/projects/euler$ ghci -ignore-dot-ghci BugTest.hs
GHCi, version 6.9.20071101: http://www.haskell.org/ghc/  :? for help
Loading package base ... linking ... done.
[1 of 1] Compiling Main             ( BugTest.hs, interpreted )
Ok, modules loaded: Main.
*Main> :print allpairs
*** Exception: ghci/Debugger.hs:84:11-72: Irrefutable pattern failed for pattern Data.Maybe.Just subst

ghc-6.9.20071101: panic! (the 'impossible' happened)
  (GHC version 6.9.20071101 for i386-unknown-linux):
        ghci/Debugger.hs:84:11-72: Irrefutable pattern failed for pattern Data.Maybe.Just subst


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

Note that it does not crash without the LANGUAGE directive, so this appears to have something to do with the polymorphic type.

cdsmith@devtools:~/haskell/projects/euler$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.9.20071101
Trac metadata
Trac field Value
Version 6.9
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component GHCi
Test case
Differential revisions
BlockedBy
Related
Blocking
CC cdsmith@twu.net
Operating system Unknown
Architecture Unknown
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information