
On 20 May 2014 20:41, Jochen Keil
The first technical problem I see is that a compiler can't easily generate a dependency graph without first parsing the whole module.
Pardon my ignorance, but couldn't you just ignore every line that doesn't start with 'import'?
I see two problems: 1) Standard Haskell has semi-colons for declaration separation, not just lines. So you could write x = do { putStrLn "Quoth I; sup?"; print "X" }; import Data.List; y = "oopie" You would have to parse this (to some depth) to figure out where x starts and the Data.List import begins. 2) With Template-Haskell enabled, you'd need to run the TH to ignore quasi-quotes that just happen to contain "import X", and if imports could appear anywhere, then TH would probably allow it, too, which would mean you'd have to run the TH in a module to find out what else it imports. With the restrictions imposed on imports being directly after module headers right now, a compiler can trivially scan through everything before even starting to parse (and quickly point out import cycles, or missing modules).