A library for parsing extensible data notation, "Edn" in Elm!
This is very useful for communicating between Clojure and Elm.
type Edn
= EdnString String
| EdnSymbol String
-- keywords are represented as strings with optional namespace
| EdnKeyword (Maybe String) String
| EdnList (List Edn)
| EdnVector (Array Edn)
-- maps in Edn can have keys that are not strings, so we represent them as a list
-- of tuples here, leaving the translation to a map up to decoders
| EdnMap (List ( Edn, Edn ))
-- sets must consist of predefined comparables in Elm, so it's represented
-- as a list on this type, leaving the translation to a set up to decoders
| EdnSet (List Edn)
| EdnNil
| EdnBool Bool
| EdnInt Int
| EdnFloat Float
| EdnChar Char
-- user defined tags have a namespace and a name, followed by a nested edn value
| EdnTag String String Edn
| EdnSymbol StringThis library doesn't provide Encoders and Decoders for the types in the Edn module.
Extensible Data Notation has a few interesting types that don't necessarily translate 1 to 1 without making some decisions about how that transform happens.
EdnMap type in this library represents
them as List (Edn, Edn).EdnSet type in this
library represents them as List Edn.So there's several things about .edn that manifest as implementation details for decoder libraries to deal with. I plan to create a decoder/encode package to accompany this, but want to keep it separate in case anyone wants to write their own that handles things differently than I do.
The tests in this library and the escaped unicode parsing are largely drawn from Robert Vollmert's excellent elm-edn library.