[Haskell-cafe] Parse text difficulty

Glynn Clements glynn at gclements.plus.com
Thu Dec 9 14:30:32 EST 2004


Malcolm Wallace wrote:

> > >   Prelude> [1..5] `zipWith (+)` [7..]
> > >   <interactive>:1: parse error on input `('
> > 
> > is there a technical reason for this or did it just happen?
> 
> If you are asking why general expressions are prohibited between
> backticks, yes, there is a reason.  The expression could be arbitrarily
> large, so you might have to search many lines to find the closing
> backtick.  But in such a situation, it is surely much more likely
> that the programmer has simply forgotten to close the ticks around
> a simple identifier.  Just think of the potential for delightfully
> baffling type error messages that might result!

There's also the issue that you wouldn't be allowed to use backticks
within such an expression, so you would need additional grammar rules
describing expressions which are allowed within backticks.

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


More information about the Haskell-Cafe mailing list