Skip to content

Commit d6c882e

Browse files
committed
Eta reduction gives better generated code
1 parent 11db59e commit d6c882e

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

src/Data/Bifoldable.purs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ bifoldMapDefaultR
107107
-> (b -> m)
108108
-> p a b
109109
-> m
110-
bifoldMapDefaultR f g p = bifoldr (append <<< f) (append <<< g) mempty p
110+
bifoldMapDefaultR f g = bifoldr (append <<< f) (append <<< g) mempty
111111

112112
-- | A default implementation of `bifoldMap` using `bifoldl`.
113113
-- |
@@ -120,7 +120,7 @@ bifoldMapDefaultL
120120
-> (b -> m)
121121
-> p a b
122122
-> m
123-
bifoldMapDefaultL f g p = bifoldl (\m a -> m <> f a) (\m b -> m <> g b) mempty p
123+
bifoldMapDefaultL f g = bifoldl (\m a -> m <> f a) (\m b -> m <> g b) mempty
124124

125125

126126
-- | Fold a data structure, accumulating values in a monoidal type.

src/Data/Bitraversable.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ bisequenceDefault
8888
. (Bitraversable t, Applicative f)
8989
=> t (f a) (f b)
9090
-> f (t a b)
91-
bisequenceDefault t = bitraverse id id t
91+
bisequenceDefault = bitraverse id id
9292

9393
-- | Traverse a data structure, accumulating effects and results using an `Applicative` functor.
9494
bifor

src/Data/Foldable.purs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ foldMapDefaultR
9696
=> (a -> m)
9797
-> f a
9898
-> m
99-
foldMapDefaultR f xs = foldr (\x acc -> f x <> acc) mempty xs
99+
foldMapDefaultR f = foldr (\x acc -> f x <> acc) mempty
100100

101101
-- | A default implementation of `foldMap` using `foldl`.
102102
-- |
@@ -108,7 +108,7 @@ foldMapDefaultL
108108
=> (a -> m)
109109
-> f a
110110
-> m
111-
foldMapDefaultL f xs = foldl (\acc x -> f x <> acc) mempty xs
111+
foldMapDefaultL f = foldl (\acc x -> f x <> acc) mempty
112112

113113
instance foldableArray :: Foldable Array where
114114
foldr = foldrArray
@@ -240,12 +240,12 @@ or = any id
240240
-- | `all f` is the same as `and <<< map f`; map a function over the structure,
241241
-- | and then get the conjunction of the results.
242242
all :: forall a b f. (Foldable f, HeytingAlgebra b) => (a -> b) -> f a -> b
243-
all p = alaF Conj foldMap p
243+
all = alaF Conj foldMap
244244

245245
-- | `any f` is the same as `or <<< map f`; map a function over the structure,
246246
-- | and then get the disjunction of the results.
247247
any :: forall a b f. (Foldable f, HeytingAlgebra b) => (a -> b) -> f a -> b
248-
any p = alaF Disj foldMap p
248+
any = alaF Disj foldMap
249249

250250
-- | Find the sum of the numeric values in a data structure.
251251
sum :: forall a f. (Foldable f, Semiring a) => f a -> a

src/Data/Traversable.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ sequenceDefault
6464
. (Traversable t, Applicative m)
6565
=> t (m a)
6666
-> m (t a)
67-
sequenceDefault tma = traverse id tma
67+
sequenceDefault = traverse id
6868

6969
instance traversableArray :: Traversable Array where
7070
traverse = traverseArrayImpl apply map pure

0 commit comments

Comments
 (0)