stil4m/elm-syntax/7.1.2

NOTE: the latest version is 7.3.9

Elm.Interface

Elm.Interface

A type that represents the interface for an Elm module. You can see this as a trimmed down version for of a file that only caontains the header (module X exposing (..)) and some small set of additional data.

Types

type alias Interface =
List Exposed

An interface is just a list of 'things' that are exposed by a module.

[ Type "Color" [ "Red", "Blue" ], Function "asRgb" ]
type Exposed
= Function String
| CustomType ( String, List String )
| Alias String
| Operator Infix

Union type for the things that a module can expose. These are Functions, CustomTypes, and Aliases.

Elm core packages can also define Operators, and thus we take that into account as well. The Infix type alias will contain all the information regarding the operator

Functions

build : RawFile -> Interface

Build an interface from a file

exposesAlias : String -> Interface -> Bool

A function to check whether an Interface exposes an certain type alias.

exposesFunction : String -> Interface -> Bool

Check whether an Interface exposes an function.

exposesFunction "A" [ Function "A", CustomType "B", [ "C" ] ] == True
exposesFunction "B" [ Function "A", CustomType "B", [ "C" ] ] == False
exposesFunction "<" [ Infix { operator = "<" , ... } ] == True
exposesFunction "A" [ Alias "A" ] == False
operators : Interface -> List Infix

Retrieve all operators exposed by the Interface