Hugs seems to have a problem with several non-enbraced !!
in a partial application.
While this works fine in GHCi:
([[0]]!!0!!)0
Hugs reports a syntax error for the )
.
Is this a bug in Hugs?
Adding an extra brace for the second list index operator works though:
(([[0]]!!)0!!)0
or
(([[0]]!!0)!!)0
This is a known issue in Hugs. From the Hugs 98 Users Guide section on Expressions:
Digression Alert
Maybe this is what
FUZxxl
was talking about in his comment?Try defining your own
(!!)
function inghc
and set it to have right-associative fixity:Now that line won't work in
ghci
either!Because
(!!)
has been set withinfixr
and is now right-associative. If you useinfixl
, that line works fine.This is a completely separate issue from the question you asked though. This is about left vs right associativity, whereas the problem with Hugs is that it just doesn't parse an expression like
(a+b+)
.