[Haskell-cafe] Re: Type classes question
Roly Perera
roly.perera at dynamicaspects.org
Wed Oct 8 07:22:59 EDT 2008
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
More information about the Haskell-Cafe
mailing list