Ticket #189 (closed bug report: wontfix)

Opened 8 years ago

Last modified 8 years ago

Ambiguous infix expression

Reported by: YurasShumovich Owned by: nibro
Priority: major Milestone:
Component: parser Version:
Keywords: Cc: shumovichy@…


Updating from HSE-1.3.4 to HSE-1.8.2 I found that the next module can't be parsed with new version:

module Main

import Control.Arrow

doSth = (+ 1) . head &&& tail

The old version parses the code successfully.

ghc-6.10.4 on Mac OS X 10.5.8

Change History

Changed 8 years ago by nibro

  • status changed from new to closed
  • resolution set to wontfix

The reason for the perceived regression is that 1.3.4 didn't handle fixities properly, while 1.8.2 does. By default, HSE is aware of only the fixities defined in the Prelude, where . is infixr 9. Any unrecognized operators are defaulted to infixl 9, which makes the example expression ambiguous.

The fix is to either not care about fixities at all (parseFileWithMode (defaultParseMode { fixities = [] } ), which gives back the old behavior and treats both . and &&& as infixl 9. Or (more correct) to make HSE aware of all base fixities (parseFileWithMode (defaultParseMode { fixities = baseFixities } ), so that &&& is correctly treated a infixr 3.

Note: See TracTickets for help on using tickets.