Changes between Version 23 and Version 24 of Commentary/Packages/GhcPackagesProposal


Ignore:
Timestamp:
Jul 6, 2006 10:49:00 PM (9 years ago)
Author:
brianh@…
Comment:

typo + section on EBNF rule for import directive

Legend:

Unmodified
Added
Removed
Modified
  • Commentary/Packages/GhcPackagesProposal

    v23 v24  
    153153}}}
    154154
    155 It is clear from the above examples that they keyword {{{from}}} is redundant - the presence of a string literal after the keyword {{{import}}} is sufficient to distinguish per-package imports from the ordinary shared-namespace imports, so the above could instead be written as
     155It is clear from the above examples that the keyword {{{from}}} is redundant - the presence of a string literal (or special keyword to denote the home package) after the keyword {{{import}}} is sufficient to distinguish per-package imports from the ordinary shared-namespace imports, so the above could instead be written as
    156156{{{
    157157    import "base"
     
    167167}}}
    168168
     169=== Syntax formalised and summarised ===
    169170
     171A possible syntax which covers everything in this proposal is therefore:
     172
     173   '''import''' [''package-name''] '''{''' ''import-specifier'' [''';''' ''import-specifier''] '''}'''
     174
     175where ''package-name'' is a string literal or the keyword {{{home}}}, the ''import-specifier'' corresponds to everything that is currently allowed after the keyword {{{import}}}, and the braces and semicolons would be added by the layout rule.
     176{{{
     177    import "base" -- searches in "base" package only
     178        Prelude hiding (length)
     179        Control.Exception
     180        qualified Data.List as List
     181
     182    import ""   -- searches in home package only
     183        A.B.C
     184
     185    import P.Q.R -- searches in home + exposed packages
     186}}}