[Haskell-cafe] Re: Re-order type (flip map)

Ozgur Akgun ozgurakgun at gmail.com
Sun Oct 10 18:47:45 EDT 2010


On 10 October 2010 22:32, Johannes Waldmann <waldmann at imn.htwk-leipzig.de>wrote:

> Oh, and while we're at it - are there standard notations
> for "forward" function composition and application?
>
> I mean instead of      h . g . f $ x
> I'd sometimes prefer   x ? f ? g ? h
> but what are the "?"
>

While asking you use the same symbol for function composition, and something
like inverse function application. I don't think there exists an operator ?,
such that h . g . f $ x is equivalent to x ? f ? g ? h.

But you can simply define an inverse function application like the following
and have a close enough alternative,

($$) :: a -> (a -> b) -> b
($$) = flip ($)
infixl 5 $$

Now the following two expression are identical, I suppose:

h . g . f $  x
x $$ f . g . h

Cheers,
Ozgur
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20101010/8726a413/attachment.html


More information about the Haskell-Cafe mailing list