This is an alternative site for discovering Elm packages. You may be looking for the official Elm package site instead.
1.0.1

Elm.Syntax.Module

Module Syntax

Module

type Module = NormalModule DefaultModuleData | PortModule DefaultModuleData | EffectModule EffectModuleData

Union type for different kind of modules

type alias DefaultModuleData = { moduleName : ModuleName , exposingList : Exposing (Ranged TopLevelExpose) }

Data for a default default

type alias EffectModuleData = { moduleName : ModuleName , exposingList : Exposing (Ranged TopLevelExpose) , command : Maybe String , subscription : Maybe String }

Data for an effect module

exposingList : Module -> Exposing (Ranged TopLevelExpose)

Get the exposing list for a module.

moduleName : Module -> Maybe ModuleName

Get the name for a module. For older modules this may not be present.

isPortModule : Module -> Bool

Check whether a module is defined as a port-module

Import

type alias Import = { moduleName : ModuleName , moduleAlias : Maybe ModuleName , exposingList : Maybe (Exposing (Ranged TopLevelExpose)) , range : Range }

Import definition

module Elm.Syntax.Module
    exposing
        ( DefaultModuleData
        , EffectModuleData
        , Import
        , Module(EffectModule, NormalModule, PortModule)
        , exposingList
        , isPortModule
        , moduleName
        )

{-| Module Syntax


# Module

@docs Module, DefaultModuleData, EffectModuleData

@docs exposingList, moduleName, isPortModule


# Import

@docs Import

-}

import Elm.Syntax.Base exposing (ModuleName)
import Elm.Syntax.Exposing exposing (Exposing(..), TopLevelExpose)
import Elm.Syntax.Range exposing (Range)
import Elm.Syntax.Ranged exposing (Ranged)


{-| Union type for different kind of modules
-}
type Module
    = NormalModule DefaultModuleData
    | PortModule DefaultModuleData
    | EffectModule EffectModuleData


{-| Data for a default default
-}
type alias DefaultModuleData =
    { moduleName : ModuleName
    , exposingList : Exposing (Ranged TopLevelExpose)
    }


{-| Data for an effect module
-}
type alias EffectModuleData =
    { moduleName : ModuleName
    , exposingList : Exposing (Ranged TopLevelExpose)
    , command : Maybe String
    , subscription : Maybe String
    }


{-| Import definition
-}
type alias Import =
    { moduleName : ModuleName
    , moduleAlias : Maybe ModuleName
    , exposingList : Maybe (Exposing (Ranged TopLevelExpose))
    , range : Range
    }


{-| Get the name for a module. For older modules this may not be present.
-}
moduleName : Module -> Maybe ModuleName
moduleName m =
    case m of
        NormalModule x ->
            Just x.moduleName

        PortModule x ->
            Just x.moduleName

        EffectModule x ->
            Just x.moduleName


{-| Get the exposing list for a module.
-}
exposingList : Module -> Exposing (Ranged TopLevelExpose)
exposingList m =
    case m of
        NormalModule x ->
            x.exposingList

        PortModule x ->
            x.exposingList

        EffectModule x ->
            x.exposingList


{-| Check whether a module is defined as a port-module
-}
isPortModule : Module -> Bool
isPortModule m =
    case m of
        PortModule _ ->
            True

        _ ->
            False