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

_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to