SML# Document Version 4.1.0
24 Module language declarations and interface

24.4 Module language interface

As defined in Section 16.2, module language interface consists of t provides for structures (⟨provideStr⟩) and for functors (⟨provideFun⟩), whose syntax is given below.

⟨provideStr⟩ ::=  structure ⟨strid⟩ = struct ⟨provideStrdecl⟩ end
⟨provideStrdecl⟩ ::= ⟨provideVal⟩
 | ⟨provideType⟩
 | ⟨provideDatatype⟩
 | ⟨provideException⟩
 | ⟨provideStr⟩
⟨provideFun⟩ ::=  functor ⟨provideFunBind⟩
⟨provideFunBind⟩ ::= ⟨funid⟩ (⟨strdesc⟩) = ⟨provideStrExp⟩

The following are examples of structure declarations and their interface.

Bool.sml file: structure Bool =
struct
  datatype bool = false | true
  fun not true = false
    | not false = true
  fun toString true = "true"
    | toString false = "false"
end
Bool.smi file: structure Bool =
struct
  datatype bool = false | true
  val not : bool -> bool
  val toString : bool -> string
end