I used Parsec and tried to write it in an applicative style using various nice infix operators that Applicative and Functor provide when I came across (<$) :: Functor f => a -> f b -> f a(part of Functor).
For Parsec (or anything with an applicative instance that I would suggest), this makes the material seem a pure x <* ylittle shorter than just saying x <$ y.
Now I wondered if there was any specific reason for the lack of an operator, such as ($>) = flip (<$) :: Functor f => f a -> b -> f b, that would allow me to express my parser x *> pure yin a more accurate form x $> y.
I know that I could always define it $>myself, but since there is both <*and the *>concept of a double / opposite / "flipped thingie" is quite common in haskell, I thought it should be in the standard library along with <$.
source
share