Skip to content

v7.0.0

Compare
Choose a tag to compare
@thomashoneyman thomashoneyman released this 19 Jun 06:50
9b00fcc

This release introduces a few major changes:

Introducing typed errors

This release introduces a shift in the way this library handles errors. Previously, errors were reported as String values when decoding. Now, errors are reported as JsonDecodeError values, which provide much richer information about what errors have occurred. This brings this library into line with purescript-codec-argonaut, which also uses typed errors.

There are new functions to help work with this error type:

  • printJsonDecodeError :: JsonDecodeError -> String can be used to recover a string error from a typed error
  • parseJson :: String -> Either JsonDecodeError Json can be used instead of Data.Argonaut.Parser.jsonParser if you need to parse a Json value from a JSON string. It uses jsonParser under the hood, but provides a typed error instead of a string error.

Implemented in #73 and relevant documentation updated in #80.

Add encoding and decoding functions without type classes

Sometimes it is useful to be able to use the encoders and decoders defined in this library without needing the type classes. If you want to use the functions directly without a type class, they can now be found in the Data.Argonaut.Decode.Decoders and Data.Argonaut.Encode.Encoders modules.

Implemented in #74.

Removed deprecated functions and operators

A number of functions and operators were deprecated in the last release. Their removal doesn't change the functionality of this library -- as noted in the prior release, all deprecated operators have functionally-equivalent alternatives. For example:

  • .? -> .:
  • .?? -> .:?
  • .?! -> .:!

Implemented in #82.

Migrate the library to use Spago

This is a purely internal change, but the purescript-argonaut-codecs library now uses Spago internally to manage dependencies and the overall build. Over time the purescript-contrib organization will shift to use Spago instead of Pulp + Bower.

Implemented in #81.