Multiple imports on a single line

Sven Panne svenpanne at gmail.com
Wed Feb 1 20:22:58 UTC 2017


2017-02-01 20:51 GMT+01:00 Marc Ziegert <Coeus at gmx.de>:

> [...] How about some more syntactic sugar?
>
> {-# LANGUAGE ImportSugar #-}
> import [Data.[Text, Foldable q-as F, Vector (Vector), Vector q-as V hiding
> (Vector)], Control.Concurrent, Data.List q (sum)]
> [...]


o_O I am really not sure if this is a serious proposal or just some funny
remark, taking the initial proposal to an extreme: Is it really a good idea
to condense something so heavily? I don't think so, deciphering the above
import probably takes you multiple times the effort to read the plain old
simple imports spanning several (easy) lines. Quoting Martin Fowler: *"Any
fool can write code that a computer can understand. Good programmers write
code that humans can understand."  *This simply looks too ingenious, so
http://wiki.c2.com/?KillYourDarlings probably applies, and so does
https://en.wikipedia.org/wiki/KISS_principle.

Apart from the incomprehensibility for humans: For every seemingly "easy"
syntactic extension, the cost for related tools like IDEs etc. has to be
considered. Have fun e.g. extending syntax highlighting to handle such
stuff.

And finally: What problem are we actually trying to solve? From my POV,
imports are largely irrelevant when reading code, you just skim over them
to get an idea, and then forget about them/fold them in your
editor/mechanically clean them up via your IDE/etc.  The only time they are
really important is when something goes wrong and/or name resolution is not
obvious. And exactly at that time, one really needs simple stuff to look
at, not a Perl-like one-liner. But as I said, that's just my opinion...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-prime/attachments/20170201/bd371922/attachment-0001.html>


More information about the Haskell-prime mailing list