haskell / alex

A lexical analyser generator for Haskell
https://hackage.haskell.org/package/alex
BSD 3-Clause "New" or "Revised" License
297 stars 82 forks source link

Release 3.1.5 seems to have caused breakage #78

Closed snoyberg closed 8 years ago

snoyberg commented 8 years ago

The example I'm seeing in Stackage is:

https://github.com/mainland/language-c-quote/issues/57

Were there any changes to alex that would explain this?

athas commented 8 years ago

The reason for this is that Data.Char.ord is no longer implicitly available in the generated code. I wouldn't say this is an error in alex - the lexer should never have assumed that it was available (and indeed it can be fixed by just importing it manually).

snoyberg commented 8 years ago

It's a breaking change in behavior. Whether the behavior was intentional or not is irrelevant; code that previously compiled does not, making this a breaking change.

simonmar commented 8 years ago

Yes, the change snuck in without me noticing. But since it's arguably more correct for Alex to not pollute the namespace with things it needs, I'm inclined to leave it as it is rather than change it back. It's not hard to fix, and the fix is backwards compatible.

athas commented 8 years ago

Simon Marlow notifications@github.com writes:

Yes, the change snuck in without me noticing. But since it's arguably more correct for Alex to not pollute the namespace with things it needs, I'm inclined to leave it as it is rather than change it back. It's not hard to fix, and the fix is backwards compatible.

It looks like alex-generated code still contains some namespace pollution, notably importing all of Data.Array and GHC.Exts. Perhaps it could be considered to import all modules as qualified, to prevent lexers from depending on implementation details in the future?

\ Troels /\ Henriksen

simonmar commented 8 years ago

Sure - but Alex is in maintenance mode, I accept pull requests and make Hackage releases but I don't do any significant work on it myself.

peti commented 8 years ago

Just out of academic curiosity: do we consider the removal of the previously exported ord function an API change or not? If it is, then the new release ought to be dubbed version 3.2 (or higher).