# Gleam Codec

A library for encoding and decoding Gleam data structures to Erlang and Elixir via codecs.

- A codec create both an encoder and decoder that are always in sync.
- A codec has an opinionated serialization format. Custom types are serialized as maps.
- A codec is not appropriate for decoding external data structures. As a codec expects a particular data structure.

## Example

import codec

type Person{
		name: String

let c = codec.record1(
        fn(p: Person) { },

let sam = Person("Sam")

codec.encode(c, sam)

Returns an Elixir map like

%{ "__type__" => "Person", "name" => "Sam" }

## Installation

If [available in Hex](
this package can be installed by adding `gleam_codec` to your `rebar.config` dependencies:

{deps, [