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
On Tue, Oct 7, 2008 at 1:13 PM, Roly Perera
[EMAIL PROTECTED] wrote:
Hi,
I'm reasonably well versed in Haskell but fairly new to defining type classes.
In particular I don't really understand how to arrange for all instances of X
to also be instances of Y.
It's quite possibly that my
Hi,
I'm reasonably well versed in Haskell but fairly new to defining type classes.
In particular I don't really understand how to arrange for all instances of X
to also be instances of Y.
It's quite possibly that my question is ill-posed, so I'll make it as concrete
as possible: in the
Hello Roly,
Tuesday, October 7, 2008, 4:13:25 PM, you wrote:
I'm reasonably well versed in Haskell but fairly new to defining type classes.
http://haskell.org/haskellwiki/OOP_vs_type_classes may be useful
--
Best regards,
Bulatmailto:[EMAIL PROTECTED]
Title: Type classes question
Hello,
I am trying to define class Dual and few instances as follows:
===
class Dual a where
dual :: a - a
instance Dual Bool where
dual = not
instance (Dual a, Dual b) = Dual (a - b) where
dual f = dual . f . dual
instance Dual a = Dual