Skip to content

Commit 0112b53

Browse files
committed
ChangeLog: add info on new demand implementation
1 parent 5933d46 commit 0112b53

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

ChangeLog.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,19 @@
4343
furtherF :: (m a -> m a) -> t -> m t
4444
```
4545
46-
* [(link)](https://github.com/haskell-nix/hnix/pull/862/files) [(link)](https://github.com/haskell-nix/hnix/pull/870/files) `Nix.Value.Monad`: `class MonadValue v m`: unflipped the arguments of methods into a classical order. As a result, `demand` now tail recurse.
46+
* [(link)](https://github.com/haskell-nix/hnix/pull/862/files) [(link)](https://github.com/haskell-nix/hnix/pull/870/files) [(link)](https://github.com/haskell-nix/hnix/pull/871/files) [(link)](https://github.com/haskell-nix/hnix/pull/872/files) [(link)](https://github.com/haskell-nix/hnix/pull/873/files) `Nix.Value.Monad`: `class MonadValue v m`: instances became specialized, Kleisli versions unflipped the arguments of methods into a classical order and moved to the `class MonadValueF`. As a result, `demand` now gets optimized by GHC and also tail recurse. Please, use `f =<< demand t`, or just use `demandF`, while `demandF` in fact just `kleisli =<< demand t`.
4747

4848
```haskell
49-
demand :: (v -> m r) -> v -> m r
50-
-- was :: v -> (v -> m r) -> m r
51-
inform :: (m v -> m v) -> v -> m v
52-
-- was :: v -> (m v -> m v) -> m v
49+
class MonadValue v m where
50+
51+
demand :: v -> m v
52+
-- was :: v -> (v -> m r) -> m r
53+
54+
class MonadValueF v m where
55+
demandF :: (v -> m r) -> v -> m r
56+
-- was :: v -> (v -> m r) -> m r
57+
informF :: (m v -> m v) -> v -> m v
58+
-- was :: v -> (m v -> m v) -> m v
5359
```
5460

5561
* [(link)](https://github.com/haskell-nix/hnix/pull/863/files) `Nix.Normal`: `normalizeValue` removed first functional argument that was passing the function that did the thunk forcing. Now function provides the thunk forcing. Now to normalize simply use `normalizeValue v`.

0 commit comments

Comments
 (0)