Roly Perera | 8 Oct 13:22

Re: Type classes question

Ryan Ingram <ryani.spam <at> gmail.com> writes:

> [...]
> 
> Here's another possible solution:
> 
> > newtype AsFunctor s a = AF { fstream :: (s a) }
> > instance (Stream f) => Functor (AsFunctor f) where
> >     fmap f (AF s) = AF (fmapStreamDefault f s)
> 
> Now to use fmap you wrap in AF and unwrap with fstream.
> 
> None of the existing solutions are really satisfactory, unfortunately.

Bulat Ziganshin <bulat.ziganshin <at> gmail.com> writes:

> http://haskell.org/haskellwiki/OOP_vs_type_classes may be useful

Many thanks to you both for the clarification and pointers.

cheers,
Roly

Gmane