#1865: GHCi debugger crashes with :print
---------------------+------------------------------------------------------
 Reporter:  guest    |          Owner:         
     Type:  bug      |         Status:  new    
 Priority:  normal   |      Milestone:         
Component:  GHCi     |        Version:  6.9    
 Severity:  normal   |       Keywords:         
 Testcase:           |   Architecture:  Unknown
       Os:  Unknown  |  
---------------------+------------------------------------------------------
 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)]
 }}}

 2. Start ghci, and pass this file as a parameter.

 3. Type `:print allpairs`

 GHCi will crash.

 {{{
 [EMAIL PROTECTED]:~/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.

 {{{
 [EMAIL PROTECTED]:~/haskell/projects/euler$ ghc --version
 The Glorious Glasgow Haskell Compilation System, version 6.9.20071101
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1865>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to