hedn- EDN parsing and encoding

Safe HaskellNone





data Value Source

A "raw" EDN value represented as a Haskell value.


Eq Value 
Ord Value 
Show Value 
IsString Value

Strings starting with ":" will become keywords.

FromEDN Value 
FromEDN TaggedValue 
ToEDN Value 
ToEDN TaggedValue 
IsString (Tagged Value)

Strings will become an tagless EDN strings.

data Tagged a Source

Abstract namespaced tag.


NoTag !a 
Tagged !a !ByteString !ByteString 


Functor Tagged 
FromEDN TaggedValue 
ToEDN TaggedValue 
Eq a => Eq (Tagged a) 
(Eq (Tagged a), Ord a) => Ord (Tagged a) 
Show a => Show (Tagged a) 
IsString (Tagged Value)

Strings will become an tagless EDN strings.

FromEDN a => FromEDN (Tagged a) 
ToEDN a => ToEDN (Tagged a) 

Internal containers

type Pair = (Value, TaggedValue)Source

A key/value pair for a EDN Map

Tag manipulation

setTag :: ByteString -> ByteString -> Tagged a -> Tagged aSource

Replace a tag on a Tagged value.

getTag :: TaggedValue -> (ByteString, ByteString)Source

Extract namespace and tag from a tagged container. Will be a pair of empty for tagless containers.

stripTag :: Tagged a -> aSource

Extract bare value from a tagged or tagless container.


tag :: ByteString -> ByteString -> a -> Tagged aSource

Attach a namespaced tag to a value.

notag :: a -> Tagged aSource

Wrap a value into tagless container.

Trivial values

nil :: TaggedValueSource

Basic EDN nil.

bool :: Bool -> TaggedValueSource

Basic EDN boolean.

true :: TaggedValueSource

Const EDN True.

false :: TaggedValueSource

Const EDN False.

char :: Char -> TaggedValueSource

Basic EDN character.

string :: Text -> TaggedValueSource

Basic EDN string.

symbol :: ByteString -> TaggedValueSource

"Bare" symbol.

symbolNS :: ByteString -> ByteString -> TaggedValueSource

A namespaced symbol.

keyword :: ByteString -> TaggedValueSource

Basic EDN keyword.

integer :: Integer -> TaggedValueSource

Basic EDN integer.

floating :: Double -> TaggedValueSource

Basic EDN fp number.


makeList :: [TaggedValue] -> ValueSource

Create an EDN List from a Value list wrapping them into empty tags.

makeVec :: [TaggedValue] -> ValueSource

Create an EDN Vector from a TaggedValue list.

makeSet :: [TaggedValue] -> ValueSource

Create an EDN Set from a TaggedValue list.

makeMap :: [Pair] -> ValueSource

Create an EDN Map from a assoc list with untagged keys and tagged values.

(.=) :: ByteString -> TaggedValue -> PairSource

Construct a Pair from a key (as EDN keyword) and a value.