|Version 1 (modified by simonmar@…, 9 years ago) (diff)|
Allow import declarations anywhere in the module
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.
- 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)
- tools that collect imports have to parse the whole file (eg. GHC's dependency analyser)
- can't easily see what is imported