Opened 11 years ago

Closed 11 years ago

#2361 closed bug (fixed)

ghci cannot :print certain functions

Reported by: guest Owned by: mnislaih
Priority: normal Milestone:
Component: GHCi Version: 6.8.2
Keywords: ghci, print, sprint Cc: mnislaih@…, arjunradhakrishna@…
Operating System: Linux Architecture: x86
Type of failure: None/Unknown Test Case: :print truncate
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

The :print dies sometimes with

ghc-6.8.2: panic! (the 'impossible' happened)

(GHC version 6.8.2 for i386-unknown-linux):

Can't unify

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

The truncate function kills it consistently. For eg, :print truncate or :sprint truncate

Change History (4)

comment:1 Changed 11 years ago by ajd

I've done a bit of testing, and it seems like this bites when :print-ing a class function with a type that includes type variables not mentioned in the class heading.

{-# LANGUAGE MultiParamTypeClasses #-}
class Bar a where
  -- This is fine
  bar :: a -> a

class Foo a where
  -- All of these trigger the bug:
  baz :: Bar b => a -> b
  foo :: Bar b => a -> b -> a
  faz :: Bar b => a -> b -> Int
  bom :: Bar b => b -> a -> b
  wow :: a -> b
  doh :: b -> a
  uhh :: a -> b -> a -> b -> a -> b -> a
  oos :: a -> a -> a -> b -> a
  -- But this doesn't:
  cod :: a -> a

class Multi a b where
  -- These two are OK
  oks :: a -> b
  sko :: b -> a
  -- These trigger the bug:
  dom :: a -> c
  piz :: b -> c
  coz :: a -> c -> b

-- Both of these functions are fine
fazola :: (Foo a, Bar b) => a -> b -> a
fazola = undefined

faz' :: (Foo a, Bar b) => a -> b -> Int
faz' = faz

Note also that a function defined as equal to a class function works fine.

comment:2 Changed 11 years ago by mnislaih

Owner: set to mnislaih
Status: newassigned

comment:3 Changed 11 years ago by mnislaih

Cc: mnislaih@… added

comment:4 Changed 11 years ago by mnislaih

Resolution: fixed
Status: assignedclosed

Thanks for the detailed bug report. Fortunately this is already fixed in 6.8.3.

Note: See TracTickets for help on using tickets.