hedn

EDN parsing and encoding

Version on this page:0.3.0.4@rev:1
LTS Haskell 22.14:0.3.0.4@rev:2
Stackage Nightly 2024-03-29:0.3.0.4@rev:2
Latest on Hackage:0.3.0.4@rev:2

See all snapshots hedn appears in

BSD-3-Clause licensed by Alexander Bondarenko
Maintained by [email protected]
This version can be pinned in stack with:hedn-0.3.0.4@sha256:d0825378a1f6ff0004b9dd6f1bd282f6e146b4168eea41bc2a6cc777babf958d,2349

Haskell EDN

An EDN parsing and encoding library.

Based on spec and hints published on GitHub.

Hackage: https://hackage.haskell.org/package/hedn

Stackage: https://www.stackage.org/package/hedn

Tutorial: https://dpwiz.gitlab.io/hedn

Examples

AST

(#haskell/edn example/kitchensink ; tagged symbol
 nil ; ugh..
 \space ; character
 "dynamic \"typing\"" ; string
 {:numbers ; keyword
  [42 ; integer
   42.0 ; floating
  ] ; Vector
  :bools
  #{true, false} ; Set (with optional commas)
 } ; Map
) ; List
import qualified Data.EDN as EDN
import qualified Data.Text.IO as Text

main = do
  edn <- Text.readFile "example.edn"
  either error print $ EDN.parseText "example.edn" edn
NoTag
  (List
     [ Tagged "haskell" "edn" (Symbol "example" "kitchensink")
     , NoTag Nil
     , NoTag (Character ' ')
     , NoTag (String "dynamic \"typing\"")
     , NoTag
         (Map
            (fromList
               [ ( NoTag (Keyword "bools")
                 , NoTag
                     (Set (fromList [ NoTag (Boolean False) , NoTag (Boolean True) ]))
                 )
               , ( NoTag (Keyword "numbers")
                 , NoTag (Vec [ NoTag (Integer 42) , NoTag (Floating 42.0) ])
                 )
               ]))
     ])

Changes

Change Log

All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning.

0.3.0.4 - 2021-11-13

  • Compatiblity with prettyprinter-1.7.1 deprecactions.

0.3.0.3 - 2011-06-19

  • GHC 9.0 support.

0.3.0.2 - 2020-11-17

  • Add liftTyped methods for template-haskell 2.16

0.3.0.1 - 2020-03-21

  • GHC 8.8 warnings fixed

0.3.0.0 - 2019-09-29

Added

  • GHC 8.8 support

Removed

  • GHC 8.0 (Stackage LTS < 11) aren’t supported due to upstream changes. You can still find a package version combination that’ll work for you.

Changed

  • AST Parser parseText and EDN decodeText no longer rely on MonadFail and work in Either String instead.

0.2.0.1 - 2019-02-18

Changed

  • uuid swapped for lighter uuid-types

Added

  • tintin-generated documentation

0.2.0.0 - 2019-01-18

Changed

  • Complete rewrite in Megaparsec.
  • Text types changed to, well, Text
  • Document with prettyprinter
  • Test suite changed to Hedgehog
  • Code repository moved to GitLab

Removed

  • GHC < 8.0 (Stackage LTS < 7) aren’t supported due to Semigroup-Monoid changes.

0.1.9.1 - 2018-12-03

Changed

  • GHC 8.4 compatibility fixes

0.1.9.0 - 2018-04-05

Fixed

  • < and > are valid for symbols and keywords.

0.1.8.2 - 2016-05-14

Changed

  • Use compat wrappers to handle GHC from 7.4 to 8.0.

Removed

  • Drop obsolete developer flag.

0.1.8.1 - 2015-10-08

Fixed

  • Update dependencies, fix deprecations, time-1.5 compat.

0.1.8.0 - 2013-11-29

Fixed

  • Use utf8-string parsing for unicode literals.