[Haskell-cafe] Proposal: Shorter Import Syntax

Adam Bergmark adam at bergmark.nl
Wed Jun 3 17:31:33 UTC 2015


+1, I thought of the exact same syntax at some point.

On Wed, Jun 3, 2015 at 7:18 PM, Michael Snoyman <michael at snoyman.com> wrote:

> That's nifty. Just about every module in the project I'm working on now
> has two lines like the former (and the same for Set). I like the new
> syntax, +1.
>
> On Wed, Jun 3, 2015 at 8:15 PM Anthony Cowley <acowley at seas.upenn.edu>
> wrote:
>
>> Hi Everyone,
>>
>> I didn't think this would see any resistance as it doesn't break
>> anything, but this is the internet, so, if you haven't already, take a
>> look at this GHC feature request
>> <https://ghc.haskell.org/trac/ghc/ticket/10478>
>>
>> The idea is that rather than writing,
>>
>> import Data.Map (Map)
>> import qualified Data.Map as M
>>
>> you could instead write,
>>
>> import Data.Map (Map) as M
>>
>> The Map identifier would imported unqualified, while M would be
>> introduced as an alias for the qualified import of Data.Map.
>>
>> Note that, currently, following a parenthesized group with the "as"
>> keyword is a parse error. So allowing this syntax would not affect any
>> currently working programs.
>>
>> I've mentioned this proposal before and gotten good response, so I
>> finally wrote it up last night after people on IRC responded
>> positively to it. As well as IRC and trac, I put the link up on
>> Twitter to get it in front of a large audience, and here's what we
>> have after a bit over 12 hours (not counting the handful of supporters
>> in IRC):
>>
>> +20
>> -2
>>
>> You can see the tweet at
>> <https://twitter.com/a_cowley/status/605909841148702720>
>>
>> I'll try to summarize the two negative votes: 1) This isn't that big a
>> burden, and we should instead focus on controlled export of class
>> instances; and 2) We should instead focus on exporting name spaces,
>> and that the ordering of parentheses and the "as" keyword is too close
>> to the existing "import Foo as F(foo)" syntax.
>>
>> Since there are these negative votes, I think it best if as many
>> people as possible at least see the proposal so the GHC developers can
>> get a better sense for the overall response.
>>
>> Anthony
>> _______________________________________________
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20150603/450c3381/attachment.html>


More information about the Haskell-Cafe mailing list