[GHC] #12693: Relax qualified import syntax

#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

#12693: Relax qualified import syntax -------------------------------------+------------------------------------- Reporter: cblp | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 (Parser) | Keywords: import, Resolution: | qualified, syntax Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: 10478 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by goldfire): While this is a fine idea, I think the best place to have this discussion is as a GHC Proposal. See https://github.com/ghc-proposals/ghc-proposals. There, the community can weigh in on pros and cons of this proposal. If the community (and the GHC Committee) accept this request, then we can use a Trac ticket to track implementation. Thanks for posting! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12693#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12693: Relax qualified import syntax -------------------------------------+------------------------------------- Reporter: cblp | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 (Parser) | Keywords: import, Resolution: | qualified, syntax Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: 10478 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by cblp): https://github.com/ghc-proposals/ghc-proposals/pull/21 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12693#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC