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

Alex generates code with unqualified imports, e.g. of `GHC.Exts` #258

Closed andreasabel closed 7 months ago

andreasabel commented 7 months ago

jukebox-0.5.4 broke with GHC 9.4 because a new export Symbol form GHC.Exts clashes with a user-defined identifier of the same name. This is pretty bad, as it is inconvenient for the user to work around this.

Unqualified imports in generated code are just a ticking time bomb. It makes packages using Alex brittle. (And there is no material need for unqualified imports.)

The way forward here is to change Alex so that all its identifiers it imports are used qualified, so that there is no risk of clashing with user-defined identifiers.

See a parallel effort in BNFC: