Generic, case
-able elm value
json encoders/decoders are pretty low-level which makes them mildly unpleasant for serialization, explicitly describing how to serialize individual data types. Data that has same shape could at the low level be coded differently, which means you have to spell it out explicitly each time.
Switching to a different format would also be a lot of work; some low-level primitives like bools might not be supported etc.
This module has all the types and operations for these generic Value
s
while Value.Morph
and most other modules contain morphs to convert your types.
AtomOrComposed Atom (Composed tag)
Generic representation of any value representable in elm
Use the MorphValue
s present in most module
s of this package
to convert a Value
.
An elm literal (that doesn't itself contain other values)
elm structure that can itself contain values
Other kinds of structures should be converted to one of these. A tuple for example can be represented as a record.
Note: To not have overly complex recursive-ish types,
a Value.Composed
can describe an invalid elm value,
for example
List [ Unit (), String "huh" ]
List (Tagged tag)
The structure of a record which can hold multiple tagged field values
RecordWithoutConstructorFunction { tag : tag
, value : Value tag
}
tag-Value
pair used to represent a field or a variant
atomKindToString : Atom -> String
Describe the type of Atom
composedKindToString : Composed tag_ -> String
Describe the type of Composed
Either an index Int or a name String that can identify a record part or variant.
Used as the tag in the narrowed result of a MorphValue
RecordWithoutConstructorFunction { index : Basics.Int
, name : String
}
Both an index Int and a name String that can identify a record part or variant.
Used as the tag in the broadened result of a MorphValue
tagMap : (tag -> tagMapped) -> Value tag -> Value tagMapped
Reduce the amount of tag information of the Value
Either
composedMap : (composed -> composedMapped) -> AtomOrComposed atom composed -> AtomOrComposed atom composedMapped
If the AtomOrComposed
is a Composed
,
change in a given way
atomMap : (atom -> atomMapped) -> AtomOrComposed atom composed -> AtomOrComposed atomMapped composed
If the AtomOrComposed
is an Atom
,
change in a given way
bundsol/
: Boxed
tricycle/elm-storage
: Storage.Value
Value
variantsandre-dietrich/elm-generic
the-sett/decode-generic
miniBill/elm-codec
MartinSStewart/elm-serialize
Bytes
fujiy/elm-json-convert
prozacchiwawa/elm-json-codec