Skip to content

An OSS project providing compatibility modules for aeson

License

Notifications You must be signed in to change notification settings

freckle/aeson-compat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

aeson-compat

Hackage Stackage Nightly Stackage LTS CI

Compatibility package between aeson major versions.

Organization

This library contains modules named Data.Aeson.VN.M, which

  1. Present the same interface as Data.Aeson.M as of aeson vN, and
  2. Compile with all versions of aeson

Example

import Data.Aeson
import qualified Data.Aeson.V2.Key as Key
import qualified Data.Aeson.V2.KeyMap as KeyMap

someExample :: IO ()
someExample = putStrLn
  $ unwords
  $ map Key.toString
  $ KeyMap.keys
  $ (\(Object km) -> km)
  $ object
    [ "hello" .= True
    , "world" .= True
    ]

Gotchas

There are cases where it's not practical to match the aeson functionality exactly when we're making compatibility functions against older (or newer) versions. The following lists concessions we've made.

  • Our version of alterF (unordered-containers < 0.2.10) may compute the hash key multiple times, since we don't have access to the internals necessary to pre-compute the key once and use it for any lookup, insert, and delete actions.
  • We may use strict implementations for should-be lazy functions (or vice versa). For example, in unordered-containers < 0.2.11, foldl = foldl' and foldr' = foldr.
  • Only one of coercionToHashMap or coercionToMap will be Just, depending on your actual aeson version.
  • Either conversions dealing with HashMap or those dealing with Map will be fast (runtime-erased), depending on your actual aeson version.

Development & Tests

stack build --fast --pedantic --test --file-watch

CHANGELOG | LICENSE

About

An OSS project providing compatibility modules for aeson

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •