instance declaration troubles

Hal Daume III hdaume@ISI.EDU
Fri, 7 Mar 2003 07:47:09 -0800 (PST)


See my "Double Argh" message, but other than that, the only way is if you
redefine your Functor class to be a subclass of Get, which means you need
to define your own and cannot use the library one (unless something like
superclass is adopted...there's a recommendation out there for this
somewhere).  You need undecidable instances because in general something
like this is not decidable.  The way that undecidable instances deals with
the problem is that it sets a depth for instance reduction and if this
depth is hit, it just dies.

That said, "undecidable instances" sound very scary, but they're really
not.  You can google around for a conversation I had with SPJ about this a
while back, but something being an und instance is a compile time
property.  That is, if compilation succeeds, you don't have anything to
worry about and the worst that can happen at compilation time is that
you'll hit the bottom of this stack.

--
 Hal Daume III                                   | hdaume@isi.edu
 "Arrest this man, he talks in maths."           | www.isi.edu/~hdaume

On Fri, 7 Mar 2003, Nick Name wrote:

> Yes, I usually RTFM before posting, but you have misunderstood my
> question (however, thanks for always reading and answering newbie
> questions like mine); what I want to do is the 
> 
> instance (Get a) => Functor a where
>      fmap f x = mk (ls x >>= return . map f)
> 
> Now, what I mean is: "any type in Get class is also in Functor class,
> and I tell you how". But I need undecidable instances! Why? Is there a
> simple way to state this property, that the Get class is a subset of the
> Functor class?
> 
> Vincenzo
> 
> 
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>