Skip to content

miniBill/elm-bare

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

elm-bare

The goal of this package is to implement the BARE Message Encoding format in Elm, using a "Codec" API.

Basic usage

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

Generator

The generator can be found at https://github.com/nilshelmig/elm-bare-generator

Learning Resources

Ask for help on the Elm Slack.

You can also have a look at the FAQ.md file.

Credits

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.