On Jan 23, 2008, at 15:10, Jonathan S. Shapiro wrote: > On Wed, 2008-01-23 at 19:52 +0000, Sam Mason wrote: >> Haskell has a nice feature where any sequence of punctuation >> characters >> is treated as an infix operator. > ... > I'm also not sure that this feature obeys lexical scoping > constraints. Does it? If not, then my negative opinion about it > goes up exponentially.
It most certainly does. Ordinary identifiers and 'operator symbols' (to use the language of the Haskell 98 Report) are identical except in parsing; the semantics do not vary, and each can be used in place of the other with appropriate markers. http://www.haskell.org/onlinereport/lexemes.html From http://www.haskell.org/onlinereport/exps.html : > An operator is either an operator symbol, such as + or $$, or is an > ordinary identifier enclosed in grave accents (backquotes), such as > `op`. For example, instead of writing the prefix application op x > y, one can write the infix application x `op` y. If no fixity > declaration is given for `op` then it defaults to highest > precedence and left associativity (see Section 4.4.2). > > Dually, an operator symbol can be converted to an ordinary > identifier by enclosing it in parentheses. For example, (+) x y is > equivalent to x + y, and foldr (*) 1 xs is equivalent to foldr (\x > y -> x*y) 1 xs. > -- Kevin Reid <http://homepage.mac.com/kpreid/> _______________________________________________ bitc-dev mailing list [email protected] http://www.coyotos.org/mailman/listinfo/bitc-dev
