[Haskell-beginners] infix and bind pseudonym
Magnus Therning
magnus at therning.org
Wed Mar 4 09:19:36 EST 2009
On Wed, Mar 4, 2009 at 1:20 PM, Daniel Fischer <daniel.is.fischer at web.de> 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.)
/M
--
Magnus Therning (OpenPGP: 0xAB4DFBA4)
magnus@therning.org Jabber: magnus@therning.org
http://therning.org/magnus identi.ca|twitter: magthe
More information about the Beginners
mailing list