
Am Mittwoch, 4. März 2009 15:19 schrieb Magnus Therning:
On Wed, Mar 4, 2009 at 1:20 PM, Daniel Fischer
wrote: Am Mittwoch, 4. März 2009 13:59 schrieb Magnus Therning:
Yes, there are certain function names that allow infix usage without the back-ticks, the name 'chain' doesn't. What those function names are? Roughly you can say that functions that they are functions that look like binary operations, like + - ++ >>> etc. I'm not sure I read the pangauage spec correctly, but it looks like operators are made up of the following characters !@#$%^&*+-./\|<=>?~ (IIRC ':' has a special meaning in that it's allowed in "constructors", cf 1:2:[]).
':' is the symbol-equivalent of an upper case letter, so it's special only if it's the first symbol of an operator name, then the operator is a constructor. It can appear in any place but the first in ordinary operators. For example: (:) :: a -> [a] -> [a] -- first symbol is ':' => constructor (:+) :: (RealFloat a) => a -> a -> Complex a -- constructor (/:/) :: a -> b -> b -- ':' not first symbol => ordinary operator
Yes, that's what I meant, but you put it more nicely :-)
Is : really allowed in the middle of an operator like that? (I can't find it at all in the description of var-symbol on the last page in http://www.cs.uu.nl/wiki/pub/FP/CourseLiterature/haskellsyntax-main.pdf , hence my question.)
When in doubt, consult the report,
http://haskell.org/onlinereport/lexemes.html
Section 2.4:
varsym
->
( symbol {symbol | :})
/M
Cheers, Daniel