Skip to content

v0.6.0

Choose a tag to compare

@mlms13 mlms13 released this 28 May 02:22

🚨 Breaking

  • Decode.fallback doesn't assume you want to work with fields, but you can use Decode.(fallback(field("x", string), "default")) if you want the old behavior
  • Decode.Pipeline.fallback has the same new behavior, but it provides fallbackField to achieve the old behavior
  • Decode.ParseError.map has been removed (it wasn't used internally or documented)
  • The Decode.ParseError variant type now includes a TriedMultiple constructor. This is only a breaking change if you are matching directly on values of this type.

🐛 Bug fixes

  • Decode.AsResult.OfStringNel actually collects multiple errors now

✨ New features

  • Decode.alt allows combining decode functions and picking the first success
  • Decode.AsResult.OfStringNel now includes all of the same map, flatMap, etc functions for decoders
  • Decode.ParseError is aliased as Decode.AsResult.OfParseError.ParseError so parse errors can be accessed from an aliased decode module

✔️ Code quality

  • Reorganize tests so that Decode_AsOption tests decoders pass-vs-fail, Decode_AsResult_* tests failure reporting
  • Test coverage has increased to 100%
  • Internally, many functions were re-written to use map, flatMap, alt, etc on the decoders themselves, rather than running the decoders and transforming the output
  • Js.Dict.key was changed to string in interface files for better editor suggestions