The goal of this package is to implement the BARE Message Encoding format in Elm, using a "Codec
" API.
Round-tripping is done through the use of encoders (a -> Encoder
) and decoders (Decoder a
) for a sequence of bytes, collectively called a Codec a
.
import Codec.Bare as Codec exposing (Bytes, Codec, Encoder)
codec : Codec (List Int)
codec =
Codec.list Codec.int
encode : List Int -> Bytes
encode list =
Codec.encodeToValue codec list
decode : Bytes -> Maybe (List Int)
decode s =
Codec.decodeValue codec s
The generator can be found at https://github.com/nilshelmig/elm-bare-generator
Ask for help on the Elm Slack.
You can also have a look at the FAQ.md
file.
This project is a fork of MartinSStewart/elm-codec-bytes (which is itself inspired by miniBill/elm-codec
), specialized for being compatible with the BARE Message Encoding.