3 `\x y -> x + y` 4 `\x y -> x + y` 5: Wrong version pasted
Rijk J. C. van Haaften
Rijk J. C. van Haaften" <rjchaaft@cs.uu.nl
Thu, 22 Aug 2002 17:00:38 +0100
I pasted the wrong version into the mail.
This is the final one:
module InfixFunction where
infixl 0 $-
infixr 0 $+
-- for left-associative functions
($<) :: a -> (a -> b) -> b
($<) x f = f x
-- for right-associative functions
($>) :: 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
Rijk-Jan van Haaften