Re: [Haskell-cafe] Re: Instances for Set of Functor, Traversable?

2010-07-27 Thread Ivan Lazar Miljenovic
o...@okmij.org writes: > class Functor' f a b where > fmap' :: (a -> b) -> f a -> f b I was about to ask why you mentioned b in the type signature as well, as I thought just having "(Functor' f b)" as a constraint in the type signature of fmap' would be sufficient, but when I went to check I

Re: [Haskell-cafe] Re: Instances for Set of Functor, Traversable?

2010-07-27 Thread Lennart Augustsson
But that's not really a solution, since it doesn't make a Functor instance for Set; it makes a Functor' instance for Set. If you are willing to not be upwards compatible then, yes, there are solutions. I think the best bet for an upwards compatible solutions is the associated constraints, www.cs.k

[Haskell-cafe] Re: Instances for Set of Functor, Traversable?

2010-07-27 Thread oleg
Lennart Augustsson wrote: > Try to make Set an instance of Functor and you'll see why it isn't. > It's very annoying. And yet the very simple, and old solution works. http://okmij.org/ftp/Haskell/types.html#restricted-datatypes We just properly generalize Functor, so that all old funct