jfmengels / review-common / NoMissingTypeExpose

rule : Review.Rule.Rule

Reports types that should be exposed but are not.

If a type is not exposed then it can be impossible to annotate functions or values that use them outside of the module. Affected types may be used in exposed function signatures, type aliases or other custom types.

import NoMissingTypeExpose

config : List Rule
config =
    [ NoMissingTypeExpose.rule
    ]

Fail

module Happiness exposing (happy, toString)

-- Type `Happiness` is private because it's not been exposed

type Happiness
    = Happy

-- Private type `Happiness` used by exposed function `toString`
toString : Happiness -> String
toString happiness =
    "Happy"

-- Private type `Happiness` used by exposed value `happy`
happy : Happiness
happy =
    Happy

Success

module Happiness exposing (Happiness, happy, toString)

type Happiness
    = Happy

toString : Happiness -> String
toString happiness =
    "Happy"

happy : Happiness
happy =
    Happy