This is a known issue in Hugs. From the Hugs 98 User Guide section in the Expressions section:
In the arms, the expression should be fexp (or case or do ). Legal expressions such as (a+b+) and (a*b+) are rejected.
Rejection warning
Perhaps this is what FUZxxl talked about in his comment?
Try defining your own function (!!) in ghc and set a right-associative commit for it:
import Prelude hiding ((!!)) infixr 5 !!
Now this line will not work in ghci either!
ghci> :t ([[0]] !! 0 !!) <interactive>:1:1: The operator `!!' [infixr 5] of a section must have lower precedence than that of the operand, namely `!!' [infixr 5] in the section: `[[0]] !! 0 !!'
Because (!!) was installed with infixr and is now right-associative. If you are using infixl , this line works fine.
This is a completely separate question from the question you asked. This applies to left and right associativity, while the problem with Hugs is that it simply does not parse an expression like (a+b+) .
source share