
9 Mar
2007
9 Mar
'07
8:27 p.m.
On Fri, Mar 09, 2007 at 05:23:06PM -0800, Conal Elliott wrote:
What was the motivation for providing the following Applicative instance?
instance Monoid a => Applicative ((,) a) where pure x = (mempty, x) (u, f) <*> (v, x) = (u `mappend` v, f x)
Is this instance described in "Applicative Programming with Effectshttp://www.soi.city.ac.uk/%7Eross/papers/Applicative.html"? I didn't spot a mention.
That's the Applicative instance corresponding to the "writer" monad. (messages, value) (["foo"], (*2)) <*> (["bar"], 2) ==> (["foo", "bar"], 4) Stefan