Thu Feb 14 16:55:25 PST 2008 Ross Paterson <[EMAIL PROTECTED]>
* add Functor, Applicative, Alternative and Monoid instances
They all have the same form:
instance ... => Functor (MyTransformer a b) where
fmap f g = g >>> arr f
instance ... => Applicative (MyTransformer a b) where
pure x = arr (const x)
f <*> g = f &&& g >>> arr (uncurry id)
instance ... => Alternative (MyTransformer a b) where
empty = zeroArrow
f <|> g = f <+> g
instance ... => Monoid (MyTransformer a b c) where
mempty = zeroArrow
mappend f g = f <+> g
M ./Control/Arrow/Transformer/Automaton.hs -1 +21
M ./Control/Arrow/Transformer/CoState.hs -1 +21
M ./Control/Arrow/Transformer/Error.hs -1 +20
M ./Control/Arrow/Transformer/Reader.hs -1 +21
M ./Control/Arrow/Transformer/State.hs -1 +21
M ./Control/Arrow/Transformer/Static.hs -2 +21
M ./Control/Arrow/Transformer/Stream.hs -3 +23
M ./Control/Arrow/Transformer/Writer.hs -1 +20
_______________________________________________
Cvs-libraries mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-libraries