- changed status to resolved
Maps do not allow tagged values as keys
Issue #2
resolved
Tagged values are perfectly acceptable as keys in EDN:
user=> {(java.util.Date.) 'test}
{#inst "2018-11-23T17:51:11.759-00:00" test}
but hedn fails to parse any Maps with tagged values:
> decode "{#inst \"2018-11-23T17:51:11.759-00:00\" test}" :: Maybe Value
Nothing
> decode "[#inst \"2018-11-23T17:51:11.759-00:00\" test]" :: Maybe Value
Just (Vec [Tagged (String "2018-11-23T17:51:11.759-00:00") "" "inst",NoTag (Symbol "" "test")])
The definition of EDNMap appears to be more restrictive than necessary, only allowing untagged keys:
type EDNMap = Map Value TaggedValue
According to the spec:
A map is a collection of associations between keys and values ... Note that keys and values can be elements of any type.
So it should be OK to change this to type EDNMap = Map TaggedValue TaggedValue
Comments (1)
-
repo owner - Log in to comment
Thanks! The restriction is lifted in a new version in #6.