hi

i seem to have stumbled upon a bug which somehow seems to be realted to 
the module system and functional dependencies.  attached are four files
(sorry about that, but it seems to happen when the class and instance are in 
different modules), 2 files per example.  

when Bug1 is loaded, no error is reported (although it should have been).
if i edit the file (say just add a blank line) using the :e feature, then an 
error is reported, but seems like the wrong error - it says
ERROR "Bug1.hs":6 - Illegal type in class constraint
while if i just move the class to the same module, i get the correct error
ERROR "Bug1.hs":8 - Undefined type variable "t'"
(GHC comes up with this same error)

when Bug2 is loaded i get the error:
INTERNAL ERROR: inheritFundeps - predicate failed to match it's own head!

although these messages dont seem related it seems like their cause is 
common.  i am using the vesrion of hugs from the CVS from about 2 weeks ago
(doesnt seem to have a number it just says YYMMDD)

bye
iavor

module Bug2a where

class Monad m => C m t e | t -> e where
    t :: t -> m e

module Bug1a where

class Eq m => C m t e | t -> e where
    t :: t -> (m,e)

import Bug2a

class C Maybe t t' => Bug1 t where
    g :: t -> Bool


{-
INTERNAL ERROR: inheritFundeps - predicate failed to match it's own head!
-}


import Bug1a


class C Int t t' => Bug1 t where
    g :: t -> Bool


{-
loading the file gives no error, but after editing it
an error is reported even though no significant change is made
(i.e. delete a blank line)
ERROR "B.hs":3 - Illegal type in class constraint
-}


Reply via email to