[GHC] #12693: Relax qualified import syntax
GHC
ghc-devs at haskell.org
Wed Oct 12 16:17:02 UTC 2016
#12693: Relax qualified import syntax
-------------------------------------+-------------------------------------
Reporter: cblp | Owner:
Type: feature | Status: new
request |
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.1
(Parser) |
Keywords: import, | Operating System: Unknown/Multiple
qualified, syntax |
Architecture: | Type of failure: None/Unknown
Unknown/Multiple |
Test Case: | Blocked By:
Blocking: | Related Tickets: 10478
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
= Problem =
Case 1.
{{{#!hs
import Data.HashMap (HashMap)
import qualified Data.HashMap as HashMap
import Data.Map (Map)
import qualified Data.Map as Map
import Data.Set (Set)
import qualified Data.Set as Set
import Data.Text (Text)
import qualified Data.Text as Text
}}}
Module names start in different columns, so the user cannot search it
without help of tools, so the code is unreadable.
Case 2.
{{{#!hs
import Data.HashMap (HashMap)
import qualified Data.HashMap as HashMap
import Data.Map (Map)
import qualified Data.Map as Map
import Data.Set (Set)
import qualified Data.Set as Set
import Data.Text (Text)
import qualified Data.Text as Text
}}}
Too many space used, too less space left for imported items list, too hard
to maintain without special tools.
= Proposal =
Allow to write `qualified` keyword after module name:
{{{#!hs
import Data.HashMap (HashMap)
import Data.HashMap qualified as HashMap
import Data.Map (Map)
import Data.Map qualified as Map
import Data.Set (Set)
import Data.Set qualified as Set
import Data.Text (Text)
import Data.Text qualified as Text
}}}
All the problems solved!
This proposal looks a little like ShorterImportSyntax and #10478, but
differs from them in such ways:
1. It doesn't actually make imports shorter in visible symbols, only in
lines used (in case of very long imported items list), a little.
2. It doesn't introduce new syntax constructions looking like existing but
doing other things.
3. It is easy to implement and understand.
4. It looks more natural from the point of view of English language.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12693>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list