Skip to content

abradley2/edn-decoder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Elm Edn Decode

This library provides decoders for the edn type exposed by edn-parser

The API quite closely follows the API of the standard elm/json library, with a few noticeable changes due to the very different natures of edn and json

You will likely want to use this library in conjunction with edn-parser as the Edn type constructor is required to query fields in edn maps.

import Edn exposing (..)
import Edn.Decode exposing (..)

type alias Person =
    { name : String
    , age : Int
    }

personDecoder = 
    decodeString
        (map2
            Person
            (keyAt (EdnString "name") string)
            (keyAt (EdnString "age") int)
        )

rawEdn = """
    { "name" "Tony"
    , "age" 32
    }
"""

result = decodeString personDecoder rawEdn

About

Decode Edn values in Elm!

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages