[Haskell-beginners] infix and bind pseudonym
Daniel Fischer
daniel.is.fischer at web.de
Wed Mar 4 08:20:25 EST 2009
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
>
> /M
More information about the Beginners
mailing list