Hi, all! It's been a while since I sent the message below to the GHC list,
which I believe is its rightful forum, but I've had no reply so far. So I
am giving the haskell list a try.

Thanks in advance. Cheers,

Jorge.

--------------------------- Mensagem Original ----------------------------
Assunto: undecidable & overlapping instances: a bug?
De:      "Jorge Marques Pelizzoni" <[EMAIL PROTECTED]>
Data:    Sab, Outubro 13, 2007 5:59 am
Para:    "GHC users" <[EMAIL PROTECTED]>
--------------------------------------------------------------------------

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

_______________________________________________
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to