On Mon, 18 Oct 2004 09:51:52 +0200 "Georg Martius" <[EMAIL PROTECTED]> wrote:
> Hi, > > On Mon, 18 Oct 2004 09:43:26 +0200, Peter Theissen <[EMAIL PROTECTED]> wrote: > > > Hi, > > is there any possibility of defining Infix-/Postfixoperators > > in Haskell? > > > > Example: > > Plus :: Int, Int -> Int > > Plus :: Int -> Int -> Int > > > Plus x y = x + y > > > > an now I�m want to use Plus in another function as an infix: > > > > Times2:: x = x Plus x > > Times2:: x = x `Plus` x Another possiblity: define a new operator (let's call it $+) and you do without the backquotes: infixl 5 $+ ($+) :: Int->Int->Int x $+ y = x+y times2 x = x $+ x This way you can specify the associativy and binding precedence and reduce the need for parenthesis. Best regards, Pedro -- Pedro Vasconcelos, School of Computer Science, University of St Andrews ----------------------------------------------------------------------- "The difference between Theory and Practice is greater in Practice than in Theory." _______________________________________________ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
