IzumiSy/elm-typed/2.0.0

NOTE: the latest version is 4.1.0

Typed

Types

type Typed tag a p

A definition of Typed data.

Users can control data modifiability by giving permission to the type variable p.

Permissions

type alias ReadOnly =
{ read : Allowed
, unwrap : Allowed
}

ReadOnly permission prohibits users to call all functions that do constructing and updating such as new, map and andThen.

type alias ReadWrite =
{ read : Allowed
, write : Allowed
, unwrap : Allowed
}

ReadWrite permission allows users to call all functions.

type alias Inunwrappable =
{ read : Allowed
, write : Allowed
}

Inunwrappable permission prohibits users to call value function to get internal implementation.

Constructor

new : a -> Typed tag a ReadWrite
inunwrappable : a -> Typed tag a (Inunwrappable_ p)

Manipulation

value : Typed tag a (Unwrappable_ p) -> a
map : (a -> a) -> Typed tag a ReadWrite -> Typed tag a ReadWrite
(a -> Typed tag b ReadWrite)
-> Typed tag a ReadWrite
-> Typed tag b ReadWrite

Serialization

encode : (a -> Value) -> Typed tag a p -> Value
decode : Decoder a -> Decoder (Typed tag a p)
encodeStrict : tag -> (a -> Value) -> Typed tag a p -> Value

Stricter version of encode that accepts a tag to check.

decodeStrict : tag -> Decoder a -> Decoder (Typed tag a p)

Stricter version of decode that accepts a tag to check.