[Haskell-cafe] Imports at bottom, why not?

Dominique Devriese dominique.devriese at cs.kuleuven.be
Tue Apr 22 18:37:26 UTC 2014

FWIW, a while ago I talked to one of the guys working on the official
Eclipse Scala plugin. He said that Scala's policy of allowing imports
pretty much everywhere made it quite hard to build an IDE that's
responsive on large codebases. It's not quite the same, because Scala
allows much more than just imports at the bottom, but still...


2014-04-22 19:59 GMT+02:00 Thiago Negri <evohunz at gmail.com>:
> When reading code, I find it quite distracting to have to get past the
> import list to reach the actual module code, as the import list can be (and
> often is) quite big.
> So, why not issue import statements at the bottom of a module file?
> Likewise, we can use "where" statements to define names used in a function
> after using them, so they don't distract the reader.
> I'm against imports at the middle of the file.
> But I guess being able to issue them at the end of the module could make
> sense if you want to get the reader straight to the code.
> A language pragma could be used to select between top imports or bottom
> imports (can't use both).
> What do you think?
> Example:
> """
> {-# LANGUAGE LateImports #-}
> module Foo where
> bar :: String
> bar = "quux"
> baz :: Fiz
> baz = mkFiz
> import Fiz (Fiz, mkFiz)
> """
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list