#2361: ghci cannot :print certain functions
------------------------------------+---------------------------------------
    Reporter:  guest                |        Owner:                 
        Type:  bug                  |       Status:  new            
    Priority:  normal               |    Milestone:                 
   Component:  GHCi                 |      Version:  6.8.2          
    Severity:  normal               |   Resolution:                 
    Keywords:  ghci, print, sprint  |     Testcase:  :print truncate
Architecture:  x86                  |           Os:  Linux          
------------------------------------+---------------------------------------
Comment (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.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2361#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to