When trying to compile the following module, ghc-3.02 dies with the
following message:

   panic! (the `impossible' happened):
           tcInstType:1

-------------------------------------------
module Impossible where
type     T a     = Int
class    C a     where foo :: Int -> IO a
instance C (T a) where foo = undefined
bar :: C a => IO a
bar = foo 12 >>= foo
-------------------------------------------

Section 4.3.2 of the Haskell report (Instance Declarations) states:

   The general form of the corresponding instance declaration is: 
      instance c' => C (T u1 ... uk) where { d } 
   where k>=0 and T is not a type synonym.

Therefore, the above program is illegal (Hugs tells me this, too). But
things are even stranger when bar is removed:

-------------------------------------------
module Impossible where
type     T a     = Int
class    C a     where foo :: Int -> IO a
instance C (T a) where foo = undefined
-------------------------------------------

ghc-3.02 happily compiles this. Bug or feature?

-- 
Sven Panne                                        Tel.: +49/89/2178-2235
LMU, Institut fuer Informatik                     FAX : +49/89/2178-2211
LFE Programmier- und Modellierungssprachen              Oettingenstr. 67
mailto:[EMAIL PROTECTED]            D-80538 Muenchen
http://www.pms.informatik.uni-muenchen.de/mitarbeiter/panne

Reply via email to