[Haskell-cafe] Proposal: Shorter Import Syntax
Michael Orlitzky
michael at orlitzky.com
Thu Jun 4 21:43:14 UTC 2015
On 06/04/2015 02:14 PM, Anthony Cowley wrote:
> Sorry, Yuras! I wanted to make sure the dissenting voices were heard.
>
> The current vote count is ~28-4. It seems like we're on the precipice
> of a fatal bike shedding, so I'm counting all the votes for keeping
> "quantified" as negative (as that's what Richard stated for himself),
> and trying to be conservative counting the +1's. I hope that's enough
> of a majority.
>
> To put things in perspective again, the Stackage package set has 10x
> as many qualified imports as unqualified imports that use the "as"
> keyword. The point here is to slightly smooth things out for the 10-1
> majority case.
>
> While I do appreciate that these two lines can potentially be mistaken
> for each other,
>
> import Map as M (fromList)
> import Map (fromList) as M
>
> I think the movement of the explicit import group is quite visibly
> striking, and, as previously noted, you could misread the former every
> time and only misunderstand 0.3% of import statements you read.
>
Here's what I don't like about this, although I'm not necessarily giving
it the thumbs down. Currently, the parentheses come at the end of the
line, like
import Foo (bar)
import qualified Foo as F (bar)
So, when your import list gets huge, it's easy to break:
import Foo (
bar1,
bar2,
,,,,
barN )
import qualified Foo as F (
baz1,
baz2,
,,,,
bazN )
With the new syntax, you have two towers of names:
import Foo (
bar1,
bar2,
...,
barN ) as F ( -- This line is ugly and important and buried
baz1,
baz2,
...
bazN )
More information about the Haskell-Cafe
mailing list