Studying functors, applicative functors and monads in Haskell, I found this definition on Wikipedia:
In functional programming, specifically Haskell, an applicative functor is a structure that is like a monad (
return
,fmap
,join
) withoutjoin
, or like a functor withreturn
.
I can't understand: it seems to me that providing return
(i.e. pure
) to a functor is not sufficient to obtain an applicative functor, because you need to provide ap
(i.e. <*>
) too, which cannot be defined in terms of fmap
and return
only. Did I miss something or Wikipedia's definition is not absolutely correct?
EDIT 2017-02-08: I found other useful insights on this question in this answer.
<*>
, that definition seems incomplete. I am racking my brain to see if you could derive<*>
just from return/fmap, and I don't think it's possible. – haof
s: bothfmap
andreturn
increase the count off
s in the type, whereas<*>
keeps it constant. – Zeta