Multiple imports on a single line

Sven Panne svenpanne at gmail.com
Thu Feb 2 07:41:49 UTC 2017


2017-02-01 22:39 GMT+01:00 Vassil Ognyanov Keremidchiev <varosi at gmail.com>:

> Yes, but it could be a bit more denser without so much repetition of
> "import", like:
>
> import Data.Text, qualified Data.Map as M, qualified Vector as V hiding
> (Vector)
>
> i.e. the same as current situation, but allow for multiple imports for the
> same word "import" comma separated. What do you think? The difference in
> syntax is not so much different, than just allowing commas.
>

I think this is worse than separate imports, each on a separate line. The
Python people have even put something like this into a PEP:
https://www.python.org/dev/peps/pep-0008/#imports This is for a very good
reason: The one-liners have very few visual hints for the reader to
comprehend it quickly. So even if Haskell allowed this comma-separated
chain of imports, code containing it probably wouldn't survive a code
review in most companies, where maintainability is the prime goal.

I often see a confusion between greater expresiveness (good goal) and
having to type less (largely irrelevant goal). By all means make the module
system more expressive, but try to avoid "clever" things for convenience.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-prime/attachments/20170202/b171490a/attachment.html>


More information about the Haskell-prime mailing list