Version 5 (modified by benl, 5 years ago)

--

Module

Module
    ::= module  ModuleId  where  ModuleBody
     |  ModuleBody 
ModuleBody
    ::= {  ExportDecl;*  ImportDecl;*  TopDecl;+  }

Modules start with an optional module identifier, followed by a list of export and import declarations. Export declarations must come before import declarations.


ExportDecl

ExportDecl
    ::= export Var
     |  export type Con

When there is an explicit export list, only those identifiers mentioned are exported from the module. If there is no export list then all identifiers are implicitly exported.


ImportDecl

ImportDecl
  ::=  import  ModuleId
   |   import  {  ModuleId;+  } 
   |   foreign import  String  Var  ::  Type

Foreign imports define the type of an external symbol.


TopDecl

TopDecl
  ::=  Pragma
   |   InfixDecl
   |   TypeKind
   |   TypeDecl
   |   DataDecl
   |   EffectDecl
   |   RegionDecl
   |   ClassDecl
   |   InstanceDecl
   |   ProjectionDecl
   |   TypeSig
   |   Binding