
29 Apr
2016
29 Apr
'16
9:23 a.m.
Applicative is actually a *sub*class of Functor. :)
Hi, well aware it's trivial so I'll be terse: do we have?:
fmap = <*> . pure
That's right. You have to wrap the "<*>" in parantheses though.
liftA2 f fa fb = f <$> fa <*> fb
So we could write for example this way?:
liftA2 f fa fb = pure f <*> fa <*> fb <*>
You don't need the last "<*>", but other than that yeah, that's exactly right.
Incidentally, do we have?:
liftA == liftM == fmap
Correct. The Prelude defines liftM in terms of do notation though for reasons that escape me. But it's basically just fmap. Daniel