Hello, I am not sure what the process is, but this seems like a good idea to me. I would only suggest that instead of 'runEndo' we call the selector 'appEndo'. We could even use some sort of infix application operator if anyone could suggest one. -Iavor On 9/13/05, Ross Paterson <ross@soi.city.ac.uk> wrote:
(regurgitating http://www.haskell.org/pipermail/libraries/2005-July/004057.html)
I propose to replace the instance
instance Monoid (a -> a) where mempty = id mappend = (.)
with
newtype Endo a = Endo { runEndo :: a -> a }
instance Monoid (Endo a) where mempty = Endo id Endo f `mappend` Endo g = Endo (f . g)
instance Monoid b => Monoid (a -> b) where mempty _ = mempty mappend f g x = f x `mappend` g x
_______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries