Fwd: [Haskell-cafe] Undecideable instances for one instance?

Christophe Poucet christophe.poucet at gmail.com
Wed Jun 7 04:35:46 EDT 2006


Hello Bulat,

You are indeed correct. However I fail to see how there is any
undecideability.  If instead one specified it as follows, it would be fine:

class Locatable a b | a -> b, b -> a where
   value :: a -> b
   wrap :: b -> a

instance Locatatable (Located a) a where

   value (L a) = a
   wrap a       = L a

It compiles fine, yet this is semantically the same.




On 6/7/06, Bulat Ziganshin <bulat.ziganshin at gmail.com> wrote:
>
> Hello Christophe,
>
> Wednesday, June 7, 2006, 12:27:22 PM, you wrote:
>
> > global instance of a typeclass (so there is no overlapping), GHC will
> > still complain about overlapping. Is there any reason this is so or is
>
> GHC compains here about undecidability, not overlapping :)
>
> > -- Illegal instance declaration for `Locatable a'
> > -- (There must be at least one non-type-variable in the instance head
> > -- Use -fallow-undecidable-instances to permit this)
> > -- In the instance declaration for `Locatable a'
>
> > Christophe(vincenz)
>
>
>
>
> --
> Best regards,
> Bulat                            mailto:Bulat.Ziganshin at gmail.com
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org//pipermail/haskell-cafe/attachments/20060607/aa29f842/attachment.htm


More information about the Haskell-Cafe mailing list