-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve the API to make it possible to reuse section binders. (#6)
- Loading branch information
Showing
7 changed files
with
87 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
namespace Symbolica.Extensions.Configuration.FSharp | ||
|
||
[<AutoOpen>] | ||
module Api = | ||
let bind = Binder.Builder() | ||
|
||
let section key sectionBinder = | ||
key |> Binder.section |> Binder.nest sectionBinder | ||
|
||
let optSection key sectionBinder = | ||
key | ||
|> Binder.optSection | ||
|> Binder.nestOpt sectionBinder | ||
|
||
let value = | ||
Binder.section >> Binder.nest Binder.Section.value | ||
|
||
let valueOf decoder = value >> Binder.bind decoder | ||
|
||
let optValue = | ||
Binder.optSection | ||
>> Binder.nestOpt Binder.Section.value | ||
|
||
let optValueOf decoder = | ||
optValue | ||
>> Binder.bind | ||
(function | ||
| Some s -> s |> decoder |> Binder.map Some | ||
| None -> None |> Success |> Binder.ofBind) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters