Mauricio wrote:
Hi,

I tested the expression below
and it doesn't work. Is there
some way to achieve that (i.e.,
turning an expression inside
parenthesis into an operator)?

2 `(flip (^^))` (3%4)

Another solution if you don't like defining extra (-|) and (|-) operators is:

  > ($2) (flip (^^)) (3%4)

The right section of function application is type lifting. The general form of this construction is:

  > ($x) (f a b c...) y z...

Which is equal to (f a b c... x y z...). That is, the construction lets you raise any argument out to before the function, thus making the partially applied function into an infix between |x| and |y x...|.

--
Live well,
~wren
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to