Version 3 (modified by benl, 5 years ago)

--

Modules

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

Module
    ::= module  ModuleId  where  ModuleBody
     |  ModuleBody 
ModuleBody
    ::= {  exportDecl;*  importDecl;*  topDecl;+  }

Exports

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.

ExportDecl
    ::= export Var
     |  export type Con

Imports

Foreign imports define the type of an external symbol.

ImportDecl
  ::=  import <moduleId> 
   |   import { <moduleId>;+ } 
   |   foreign import "<string>" <var> :: Type