Change `withShownDefault` and `valueWithShown` to accept a function
### [Change withShownDefault to accept a function](https://github.com/NorfairKing/opt-env-conf/pull/17/commits/1f3567bf35a4989186a3bb35669afebabe4fb927)
[1f3567b](https://github.com/NorfairKing/opt-env-conf/pull/17/commits/1f3567bf35a4989186a3bb35669afebabe4fb927)
It's common to use this function on a type with a custom "show-like"
function. Under such usage, the ergonomics are not ideal:
```hs
withShownDefault defaultFoo (showFoo defaultFoo)
```
This function is more ergonomic:
```hs
withShownDefault showFoo defaultFoo
```
As an example, the simplified `withDefault = withShownDefault show`
reads very clearly. The previous behavior can also be recovered easily
with `const`.
### [Update valueWithShown to accept a function](https://github.com/NorfairKing/opt-env-conf/pull/17/commits/5bbbebd650b1c77f1b8f15784c9501463f3d5df0)
[5bbbebd](https://github.com/NorfairKing/opt-env-conf/pull/17/commits/5bbbebd650b1c77f1b8f15784c9501463f3d5df0)
The arguments for this are the same as the previous change to
`withShownDefault`.
### [Version bump and CHANGELOG](https://github.com/NorfairKing/opt-env-conf/pull/17/commits/4f135bf3e639c03debc02c01976ca1389c5372d8)
合并状态:未合并 关闭于 2024-11-05 1 条评论