Skip to content

miniBill/elm-bare

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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/miniBill/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.