
#10478: Shorter import syntax -------------------------------------+------------------------------------- Reporter: acowley | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: Phab:D1238 -------------------------------------+------------------------------------- Comment (by thomie): Here is an overview for two of the proposals listed on this ticket. Please inform me of any mistakes there might be, and I will edit this comment. I'm using the variant of goldfire's proposal with `(..)` instead of `*`, and where `(..) ` at the end of the line can be omitted. @goldfire: I understand your proposal would (also) be fully backward compatible. Please tell me on which rows you would recommend to use the old syntax. And maybe there's a useful trick only your proposal supports? Suppose the `module A` exports `x` and `y`. * Without a module alias: ||= # =||= Haskell 2010 =||= Proposal acowey || Proposal goldfire =||= Brings into scope =|| || 1 || import A || **import A** || **import A (..) qualified** || x, y, A.x, A.y || || 2 || import A (x) || **import A (x)** || **import A (..) qualified (x)** || x, A.x || || 3 || import qualified A || **import A () as A** || **import A qualified** || A.x, A.y || || 4 || import qualified A (x) || **import A () as A (x)** || **import A qualified (x)** || A.x || * With a module alias: ||= # =||= Haskell 2010 =||= Proposal acowey || Proposal goldfire =||= Brings into scope =|| || 5 || import A as B || **import A as B** || **import A (..) qualified as B** || x, y, B.x, B.y || || 6 || import A as B (x) || **import A as B (x)** || **import A (x) qualified as B (x)** || x, B.x || || 7 || import qualified A as B || **import A () as B** || **import A qualified as B** || B.x, B.y || || 8 || import qualified A as B (x) || **import A () as B (x)** || **import A qualified as B (x)** || B.x || * The real deal: ||= # =||- Haskell 2010 =||= Proposal acowey || Proposal goldfire =||= Brings into scope =|| || 9 || import A (x); || **import A (x) as B** || **import A (x) qualified as B** || x, B.x, B.y || || || import qualified A as B || || 10 || //(impossible)// || **import A (x) as X ()** || **import A (x) qualified ()** || x || Potentially confusing things about these proposals, assuming full backward compatibility: ||= proposal =||= H2010 syntax =||= new syntax =||= Why confusing? =|| ||= acowley =|| **import A as B (x)** || **import A (x) as B** || look similar, do different things || ||= goldfire =|| **import qualified A as B (x)** || **import A (x) qualified as B** || look similar, do different things || ||= goldfire =|| **import qualified A** || **import A qualified** || look different, do the same thing || -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10478#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler