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

Richard A. O'Keefe ok at cs.otago.ac.nz
Thu Apr 24 00:51:57 UTC 2014


Someone asked "what about other languages that use bottom imports?"

It's actually a pretty rare language feature.  Off-hand, I've used
more languages where assignment is (or can be) written
"expr -> var" than languages with bottom imports.

If you don't want to be distracted by imports, you could use your
favoured editor's chroma-coding features to colour them grey, so
that your eye naturally skips to the rest of the code.

One major problem is that as long as
(a) you need to read other people's code as well as your own and
(b) the language allows top imports,
allowing bottom imports will FAIL TO SOLVE the problem it was
invented for:  you will *still* have to deal with top imports
when reading other people's code.

To be honest, folding the imports seems to me like the perfect
solution: no language change (given that there _are_ other compilers
than GHC, this seems like a Good Thing), a click away when you do
want to see what's there but just one (-)imports line when you don't.

I for one *prefer* seeing the imports at the top; I would find
imports at the bottom very unpleasant to work with.  Perhaps that's
because I'm used to top imports everywhere else.




More information about the Haskell-Cafe mailing list