In the context that you are seeing these two statements inside a do
block (i.e. when writing a Choice
for example), they probably mean the same thing.
pure
is a function that is defined in Applicative
typeclass, whereas return
is defined in the Action
typeclass (aka Monad
), which is a ‘subclass’ of the former, if you like. I believe that the implementation of return
is just return = pure
.
The only difference, as a developer, when looking at code outside the do
notation, is that if you see return
, you can assume that you can use monadic >>=
in addition to <*>
and liftA2
from Applicative
. The converse is not true.
**edit: Please see @cocreature’s post below **