Add flipped fmap
wren ng thornton
wren at community.haskell.org
Thu Apr 8 18:16:10 EDT 2010
wren ng thornton wrote:
> Edward Kmett wrote:
>> <**> cannot be defined in terms of flip as it swaps the order of the
>> effects as well.
>
> But I thought:
>
> (<**>) = liftA2 (flip ($))
>
> :)
If (<**>) were to have been defined as flip(liftA2(flip($))), then I
would be supportive of it. My definition has the same perspicuous type
as (<*>) but adding support for non-LtR ordering of effects/evaluation,
which seems to be the goal of the (<**>) combinator. However, (<**>) as
it is actually defined forces one to give up the applicative style in
order to alter evaluation ordering. In so doing it does not come to
support another style and therefore simply looks like a wart on the API.
Someone might could make an argument for (<**>) supporting a sort of
object-oriented style in terms of evaluation order, but that style is
not otherwise supported by the Applicative combinators, and so I
wouldn't find it convincing.
--
Live well,
~wren
More information about the Libraries
mailing list