[GHC] #10478: Shorter import syntax

GHC ghc-devs at haskell.org
Thu Jun 4 20:10:08 UTC 2015


#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:
 Type of failure:  None/Unknown      |  Unknown/Multiple
      Blocked By:                    |               Test Case:
 Related Tickets:                    |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------

Comment (by acowley):

 I don't think a desire to keep the `qualified` word is more logical or
 obvious than any other option. I can't think of another programming
 language that uses the `qualified` keyword. Agda uses `import M as N` to
 create a qualified alias. Python imports qualified by default. But this is
 Haskell, so we should consider how Haskell is used. If you grep over the
 source of all packages in the Stackage package set, you will find that
 `import` statements that use the `as` keyword are `qualified` 10x more
 than unqualified. If you focus on the specific syntax, `import Foo as
 F(bar)`, it is used in less than 0.3% of all import statements. So we are
 loading by far the more common usage with extra syntax.

 I suggest a way of reading import statements as "import ModuleName
 (unqualifiedImports)" If you want to use qualified names, all of that
 information is given by appending a suffix to the import statement
 beginning with the `as` keyword.

 This is certainly ''new'' syntax, but I have yet to see any quantifiable
 argument that it is less logical or undesired (see the support for the
 proposal linked from the haskell-cafe thread). Also note that the proposal
 will not break ''anything'': if you find `qualified` easier to read, then
 you can continue to use it. If nobody uses the new syntax because it is
 hard to understand, then nobody will suffer.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10478#comment:10>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list