harmboschloo/graphql-to-elm-package/1.0.1

GraphQL.Optional

An Optional can be Present, Null or Absent.

type Optional a
= Present a
| Null
| Absent
map : (a -> b) -> Optional a -> Optional b
withDefault : a -> Optional a -> a
toMaybe : Optional a -> Maybe a
fromMaybe : Optional a -> Maybe a -> Optional a

Encode

encode : (a -> Value) -> Optional a -> Maybe Value

Encode an Optional value.

encodeList : (a -> Value) -> List (Optional a) -> Value

Encode a list of Optional values. Absent values are omitted.

encodeObject : List ( String, Optional Value ) -> Value

Encode a object of Optional fields. Absent fields are omitted.

Decode

fieldDecoder : String -> Decoder a -> Decoder (Optional a)

Decode a JSON object with a Optional field.

nonNullFieldDecoder : String -> Decoder a -> Decoder (Maybe a)

Decode a JSON object with a Optional field that can be present or absent but not null.