[Haskell-cafe] newbe question

Glynn Clements glynn at gclements.plus.com
Tue Sep 27 12:39:58 EDT 2005


feucht at uni-koblenz.de wrote:

> > obviously, Hugs thinks that =- is a special operator.  In Haskell you have the 
> > ability to define your own operators, so it would be possible to define an 
> > operator =-.  I would suggest that you always put spaces around the = in 
> > declarations.
> > 
> > Best wishes,
> > Wolfgang
> >
> 
> Hello,
> thank you for fast reply. 
> Ok, but what is the semantic of '=-' ? If it's an operator, it should
> have some impact (right term?).

It isn't defined in the prelude or any of the standard libraries.

The point is that the Haskell tokeniser treats any consecutive
sequence of the symbols !#$%&*+./<=>?@^|-~ as a single operator token. 
This occurs regardless of whether a definition exists for the
operator.

More generally, the tokenising phase is unaffected by whether or not
an operator, constructor, identifier etc is defined. A specific
sequence of characters will always produce the same sequence of tokens
regardless of what definitions exist.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the Haskell-Cafe mailing list