6 Jul 01:14
Re: Re: Definition of hidden instance members (bug in GHC or Hugs+Yhc)
Brandon S. Allbery KF8NH <allbery <at> ece.cmu.edu>
2008-07-05 23:14:56 GMT
2008-07-05 23:14:56 GMT
On 2008 Jul 5, at 19:02, Neil Mitchell wrote: >> This is either a GHC bug, or a Yhc+Hugs bug - I'm not sure which, but >> the compilers disagree: >> >> import Prelude hiding ((==)) >> data Foo = Foo >> instance Eq Foo where >> (==) a b = True > > I was thinking that GHC's behaviour seems more sensible, but the > following fails: > > import qualified Module as M > > instance MClass Foo where > M.foo = undefined > > M. is not allowed as a prefix of a function, which makes resolving > ambiguities hard unless the compiler solves the issue for you (as Hugs > and Yhc do) But this works for me in ghc: foo.hs: > import Mod as M > > data Bar a = Bar Int a > > instance M.MClass (Bar a) where > foo _ = M.foozero > foozero = Bar 0 (undefined :: a) > > main = putStrLn "foo" Mod.hs: > module Mod where > > class MClass a where > foo :: a -> a > foozero :: a -- -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery <at> kf8nh.com system administrator [openafs,heimdal,too many hats] allbery <at> ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH
RSS Feed