|
|
|
## Allow import declarations anywhere in the module
|
|
|
|
|
|
|
|
**Tickets:**[\#82](https://gitlab.haskell.org//haskell/prime/issues/82)
|
|
|
|
|
|
|
|
|
|
|
|
There is no problem in theory with allowing import declarations to be placed anywhere at the top level of a module, instead of requiring them to be before all the value declarations as in Haskell 98.
|
|
|
|
|
|
|
|
**For:**
|
|
|
|
|
|
|
|
- simplifies the syntax, more consistent
|
|
|
|
- makes it easier to add a temporary import (eg. imagine using 'trace' for
|
|
|
|
debugging, you can put 'import Debug.Trace' right next to the use, rather
|
|
|
|
than at the top of the module where you'll probably forget about it)
|
|
|
|
- simpler for tools that auto-generate code, or annotate existing code
|
|
|
|
(eg. Happy wants to add imports sometimes)
|
|
|
|
|
|
|
|
**Against:**
|
|
|
|
|
|
|
|
- tools that collect imports have to parse the whole file (eg. GHC's
|
|
|
|
dependency analyser)
|
|
|
|
- can't easily see what is imported |