stil4m / elm-syntax / Elm.Syntax.Exposing

This syntax represents the exposing declaration for both imports and module headers. For example:

exposing (Foo(..))
exposing (..)

Types


type Exposing
    = All Elm.Syntax.Range.Range
    | Explicit (List (Elm.Syntax.Node.Node TopLevelExpose))

Different kind of exposing declarations


type TopLevelExpose
    = InfixExpose String
    | FunctionExpose String
    | TypeOrAliasExpose String
    | TypeExpose ExposedType

An exposed entity


type alias ExposedType =
{ name : String
, open : Maybe Elm.Syntax.Range.Range 
}

Exposed Type

Functions

exposesFunction : String -> Exposing -> Basics.Bool

Check whether an import/module exposing list exposes a certain function. Will yield True if Exposing is exposing everything (All).

exposesFunction "something" (All someRange) == True

exposesFunction "divide" (Explicit [ Node someRange (FunctionExpose "add") ]) == False

exposesFunction "add" (Explicit [ Node someRange (FunctionExpose "add") ]) == True

operators : List TopLevelExpose -> List String

Collect all operator names from a list of TopLevelExposes

Serialization

encode : Exposing -> Json.Encode.Value

Encode an Exposing syntax element to JSON.

decoder : Json.Decode.Decoder Exposing

JSON decoder for an Exposing syntax element.