Symbolica.Extensions.Configuration.FSharp Versions Save

Provides a safe API for binding the dotnet IConfiguration to types in F#.

0.4.0

2 years ago

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: https://github.com/Symbolica/Symbolica.Extensions.Configuration.FSharp/compare/0.3.0...0.4.0

0.3.0

2 years ago

New Features

  • Added Decode.uri for decoding values to System.Uri (#8).

0.2.0

2 years ago

Breaking Changes

  • section and optSection are no longer computation expressions. They are now combinator functions that allow the binding of child sections to be nested under require and optional parent sections respectively. A new bind CE takes their place for performing the binding of individual values. The crucial difference is that bind implicitly operates at the same level of the IConfiguration that it is fed. This means that it's now possible to write a single bind CE for a type and then reuse it in either an optional or required section. See the example in the README for more details.

0.1.0

2 years ago