[Haskell-cafe] Proposal: Shorter Import Syntax
amindfv at gmail.com
amindfv at gmail.com
Wed Jun 3 18:41:15 UTC 2015
El Jun 3, 2015, a las 14:32, Kosyrev Serge <_deepfire at feelingofgreen.ru> escribió:
> Anthony Cowley <acowley at seas.upenn.edu> writes:
>> The idea is that rather than writing,
>>
>> import Data.Map (Map)
>
> The head parses this in following steps:
>
> 1. import FQMN ≡ we're going to directly import from FQMN
> 2. import FQMN (…) ≡ ok, the scope is restricted by the parens
>
>> import qualified Data.Map as M
>
> 1. import qualified FQMN ≡ we're going to import qualified names from FQMN
> 2. import qualified FQMN as X ≡ ok, and the prefix is going to be X
>
>> you could instead write,
>>
>> import Data.Map (Map) as M
>
> …and you see how this is broken:
>
> 1. import FQMN ≡ we're going to directly import from FQMN (not!)
> <category error red light flashing>
>
> In other words, if you intend to keep all three cases, you're going to
> have an ugly inconsistency. Sure, it's small and contained, but still
> it's an inconsistency that's going to have a non-zero cost in the long run.
>
>
I think the existing syntax that this most-closely corresponds to is "import Data.Map as Map" (note the "as" without "qualified")
Tom
> --
> respectfully,
> Косырев Серёга
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
More information about the Haskell-Cafe
mailing list