Hi, all!

I am quite intrigued at the behaviour examplified in the attached module.
It's true I am a newbie and probably don't quite get the whole consequence
spectrum of -fallow-undecidable-instances, but why providing that dummy
instance (commented out) get the thing to compile?

By the way, I'm using GHC 6.6 on WinXP (actually, latest Visual Haskell
with MS Visual Studio 2005) and the error message I get is:

FooModule.hs:13:9:
    Could not deduce (Show a) from the context (Concrete a b)
      arising from use of `bar' at FooModule.hs:13:9-13
    Possible fix: add (Show a) to the class or instance method `foo'
    In the expression: bar x
    In the definition of `foo': foo x = bar x
    In the definition for method `foo'

A second question: which kinds of overlapping are covered by
-fallow-overlapping-instances? It seems that the following (also in the
attached module) is not allowed:

instance (Show a, Abstract a b) => Concrete a b where
        foo x = show x

instance (Abstract a b) => Concrete a b

which gives me the message:

FooModule.hs:17:0:
    Duplicate instance declarations:
      instance [overlap ok] (Show a, Abstract a b) => Concrete a b
        -- Defined at FooModule.hs:17:0
      instance [overlap ok] (Abstract a b) => Concrete a b
        -- Defined at FooModule.hs:30:0

Thanks in advance for any pointers. Cheers,

Jorge.

Attachment: FooModule.hs
Description: Binary data

_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to