[Haskell-cafe] Proposal: Shorter Import Syntax

Kosyrev Serge _deepfire at feelingofgreen.ru
Wed Jun 3 18:32:41 UTC 2015


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.


-- 
respectfully,
Косырев Серёга


More information about the Haskell-Cafe mailing list