On 3/1/06, Johannes Waldmann <[EMAIL PROTECTED]> wrote:
> But my point was that I want to use
> "do notation" for Sets (in fact, for any kind of collection)
> so I'd need the original Functor and Monad.
I understand this for Monad. Why not just redefine Functor, Oleg-style?
> I couldn't use ghc's
Jim Apple wrote:
> class MyMap f a b where
> myMap :: (a -> b) -> f a -> f b
> instance (Functor f) => MyMap f a b where
> myMap = fmap
> instance (Ord a, Ord b) => MyMap Data.Set.Set a b where
> myMap = Data.Set.map
OK (I guess).
But my point was that I want to use
"do notation" for
On 2/28/06, Johannes Waldmann <[EMAIL PROTECTED]> wrote:
> Malcolm Wallace wrote:
>
> > But if contexts-on-datatypes worked correctly,
> >
> > data Set a = Ord a =>
> >
> > then even the "real" map from Data.Set:
> >
> > map :: (Ord a, Ord b) => (a -> b) -> Set a -> Set b
> >
> > could
> > But if contexts-on-datatypes worked correctly,
> >
> > data Set a = Ord a =>
> >
> > then even the "real" map from Data.Set:
> >
> > map :: (Ord a, Ord b) => (a -> b) -> Set a -> Set b
> >
> > could be an instance method of Functor.
>
> I'd love that. But I don't quite unders
Malcolm Wallace wrote:
> But if contexts-on-datatypes worked correctly,
>
> data Set a = Ord a =>
>
> then even the "real" map from Data.Set:
>
> map :: (Ord a, Ord b) => (a -> b) -> Set a -> Set b
>
> could be an instance method of Functor.
I'd love that. But I don't quite unde