Skip to content

Commit cf884d7

Browse files
committed
Utils: add type TransformF
Explain `Transform{,F}` It allows easier reading.
1 parent a6a4826 commit cf884d7

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

ChangeLog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@
55

66
* Additional:
77

8+
* `Nix.Utils`:
9+
* added type `TransformF`
10+
811
* `Nix.Eval`:
912
* added fun
1013
* `evalContent`
1114

15+
1216
### [(diff)](https://github.com/haskell-nix/hnix/compare/0.13.0.1...0.13.1#files_bucket) 0.13.1 (2021-05-22)
1317
* [(link)](https://github.com/haskell-nix/hnix/pull/936/files) `Nix.Parser`: `annotateLocation`: Fix source location preservation.
1418
* [(link)](https://github.com/haskell-nix/hnix/pull/934/files) Require Cabal dependency `relude` `>= 1.0`: since imports & Cabal file got cleaned-up & that clean-up depends on `relude` reimports introduced in aforementioned version.

src/Nix/Eval.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ addSourcePositions f (v@(AnnE ann _) :: NExprLoc) =
538538
addStackFrames
539539
:: forall v e m a
540540
. (Scoped v m, Framed e m, Typeable v, Typeable m)
541-
=> Transform NExprLocF (m a)
541+
=> TransformF NExprLoc (m a)
542542
addStackFrames f v =
543543
do
544544
scopes <- currentScopes :: m (Scopes m v)

src/Nix/Utils.hs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,27 @@ traceM = const pass
3434
{-# inline traceM #-}
3535
#endif
3636

37-
$(makeLensesBy (\n -> pure ("_" <> n)) ''Fix)
37+
$(makeLensesBy (\n -> pure $ "_" <> n) ''Fix)
3838

3939
-- | > Hashmap Text -- type synonym
4040
type AttrSet = HashMap Text
4141

42-
-- | F-algebra defines how to reduce the fixed-point of a functor to a
43-
-- value.
42+
-- | F-algebra defines how to reduce the fixed-point of a functor to a value.
4443
-- > type Alg f a = f a -> a
4544
type Alg f a = f a -> a
4645

4746
-- | > type AlgM f m a = f a -> m a
4847
type AlgM f m a = f a -> m a
4948

50-
-- | "Transform" here means a modification of a catamorphism.
49+
-- | Do according transformation.
50+
--
51+
-- It is a transformation of a recursion scheme.
5152
type Transform f a = (Fix f -> a) -> Fix f -> a
53+
-- | Do according transformation.
54+
--
55+
-- It is a transformation of a recursion scheme.
56+
-- See @Transform@.
57+
type TransformF f a = (f -> a) -> f -> a
5258

5359
loeb :: Functor f => f (f a -> a) -> f a
5460
loeb x = go

0 commit comments

Comments
 (0)