Automatically derived instances
Marc A. Ziegert
coeus at gmx.de
Mon Aug 29 18:56:49 EDT 2005
just try to compile it with
ghc -fallow-overlapping-instances -Wall --make Main.hs
or inseart sth. like this at the first line:
{-# OPTIONS -fglasgow-exts -fffi -fallow-undecidable-instances -fallow-overlapping-instances #-}
- marc
Am Montag, 29. August 2005 05:25 schrieb Juan Carlos Arevalo Baeza:
> David Menendez wrote:
>
> >Juan Carlos Arevalo Baeza writes:
> >
> >
> >
> >The way Haskell type classes
> >work, the overlap is determined without looking at the context, so "Show
> >a" will overlap with every possible instance for Show, including Show
> >Int, which is predefined.
> >
> >
>
> Ah. :-P Bummer.
>
> >I'm not sure what the official justification for that is, but reason is
> >to avoid situations like this:
> >
> > class A t where a :: t
> > class B t where b :: t
> > class C t where c :: t
> >
> > instance A t => C t where c = a
> > instance B t => C t where c = b
> >
> > instance A Char where a = 'a'
> > instance B Char where b = 'b'
> >
> >What should c :: Char evaluate to?
> >
> >
>
> Right. Ambiguity. But as long as there's no ambiguity, there's no
> reason to be this restrictive. Oh, well.
>
> JCAB
>
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at haskell.org
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
>
>
More information about the Glasgow-haskell-users
mailing list