3 `\x y -> x + y` 4 `\x y -> x + y` 5
Rijk J. C. van Haaften
Rijk J. C. van Haaften" <rjchaaft@cs.uu.nl
Thu, 22 Aug 2002 16:52:26 +0100
>module InfixFunction where
>
>-- This is a flipped $
>infixl 0 $-
>($-) :: a -> (a -> b) -> b
>($-) x f = f x
>
>example1 :: Int
>example1 =
> -- 3 `\x y -> x + y` 4
> 3 $- (\y x -> x + y) 4
>
>example2 :: Int
>example2 =
> -- 1 `\x y -> x + y` 2 `\x y -> x` 3
> 1 $- (\y x -> x + y) 2 $- (\y x -> x + y) 3
Note the swap in argument order in the lambda abstractions!
Rijk-Jan van Haaften