[Haskell-beginners] Context reducion Stack overflow
Brent Yorgey
byorgey at seas.upenn.edu
Mon May 4 15:54:28 EDT 2009
On Mon, May 04, 2009 at 11:59:54AM -0300, Marco Túlio Gontijo e Silva wrote:
> > instance (F f, M m (f a)) => M m a where
> > mm f v = mm (m f) v
Perhaps you mean
instance (F f, M m a) => M m (f a) where ...
?
What you have written means that to have an instance M m a, you must
have an instance M m (f a), for which you must have an instance M m (f
(f a)), for which you must have an instance M m (f (f (f a)))...
What I have written above expresses what I presume you meant: we can
automatically derive an instance of (M m) for some structured type (f
a) as long as we have a base instance M m a and can lift functions (a
-> a) to (f a -> f a).
-Brent
More information about the Beginners
mailing list