
4 May
2009
4 May
'09
3:54 p.m.
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