Skip to content

0.4.0

Latest
Compare
Choose a tag to compare
@Choc13 Choc13 released this 25 Nov 19:38
eef5a30

Breaking Changes

There have been quite a few cosmetic changes to the public API in this release. In 0.3.0 the Api module was auto opened, but this is no longer the case and instead most things are now located in the Bind module. So by and large most changes can be fixed be adding Bind. to the front of the function call. For example section -> Bind.section. A summary of the crucial breaking changes are listed below:

  • BindResult has been made generic on the error type.
  • The error type in the top level API is now long string list, but instead a custom Error type. This is to facilitate applicative and alternative accumulation of errors, as well as making the errors easier to compose and more descriptive.
  • Binder has been made completely generic.
  • The Decoder type has been removed and everything is a Binder now, just with different input types.
  • The Decode module is gone and these functions are now in the Bind module.
  • valueOf has been removed. Bind.valueAt takes its place and even if the value being bound is a string it must still be specified with Bind.string. For example Bind.valueAt "key" Bind.string. This helps to unify the API by not treating string binding as a special case.

API Translation from 0.3.0

The following is a list of the most common translations from the code in 0.3.0 to the equivalent in 0.4.0:

  • section -> Bind.section
  • optSection -> Bind.optSection
  • value "key" -> Bind.valueAt "key" Bind.string
  • valueOf Decode.bool "key" -> Bind.valueAt "key" Bind.bool
  • optValue "key" -> Bind.optValueAt "key" Bind.string
  • optValueOf Decode.bool "key" -> Bind.optValueAt "key" Bind.bool

New Additions

  • A custom Error type. Error messages can be still be obtained at the top level by calling ToString() on an Error instance.
  • The Bind module.
  • The following new functions have been added to the BindResult module.
    • alt
    • getOrFail
    • ofResult
    • mapFailure
    • traverseOpt
    • sequenceOpt
    • traverseList
    • sequenceList
  • The following new functions have been added to the Binder module.
    • ask
    • alt
    • contramap
    • mapFailure
    • traverseOpt
    • sequenceOpt
    • traverseList
    • sequenceList

Full Changelog: 0.3.0...0.4.0