Proposal: add $> to Data.Functor
Dan Burton
danburton.email at gmail.com
Sun Dec 8 19:12:50 UTC 2013
($>) is analogous to (*>) not by dropping the f in the first position, but
the f in the second, as proposed.
(*>) :: Applicative f => f a -> f b -> f b
($>) :: Functor f => f a -> b -> f b
It is unfortunate that (*>) is not equivalent to (flip (<*)), but it is a
special case where breaking the "flipped characters" convention is useful
for the sake of Applicative's convention to gather effects from left to
right. It is nice that ($>) adheres to the flipped characters convention as
well as being analogous to (*>).
-- Dan Burton
On Sun, Dec 8, 2013 at 9:22 AM, Stijn van Drongelen <rhymoid at gmail.com>wrote:
> > Data.Functor has <$> and <$, but not $>, which should be a flipped
> version
> > of <$, analogous to <*>, <*, and *> in Control.Applicative.
>
> Whoa there, it's not at all analogous. Your wording is almost suggesting
> that <* is a flipped *>, but beyond that, they are uncomparable to begin
> with.
>
> Applicative functors:
>
> (<*>) :: Applicative f => f (a -> b) -> f a -> f b
> (<*) :: Applicative f => f a -> f b -> f a
> (*>) :: Applicative f => f a -> f b -> f b
>
> Removing the `f` in the first position, you'd get an honest analogue for
> any functor:
>
> (<$>) :: Functor f => (a -> b) -> f a -> f b
> (<$) :: Functor f => a -> f b -> f a
> ($>) :: Functor f => a -> f b -> f b
>
> Here, I don't see how ($>) could be anything else than `const id`.
>
> Or am I missing something here?
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20131208/53e612c2/attachment.html>
More information about the Libraries
mailing list