Skip to content

Commit ab7a9a2

Browse files
authored
Merge pull request #57 from mlang/eta-reduce
Eta reduction gives better generated code
2 parents 0c18323 + d6c882e commit ab7a9a2

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
@@ -97,7 +97,7 @@ foldMapDefaultR
9797
=> (a -> m)
9898
-> f a
9999
-> m
100-
foldMapDefaultR f xs = foldr (\x acc -> f x <> acc) mempty xs
100+
foldMapDefaultR f = foldr (\x acc -> f x <> acc) mempty
101101

102102
-- | A default implementation of `foldMap` using `foldl`.
103103
-- |
@@ -109,7 +109,7 @@ foldMapDefaultL
109109
=> (a -> m)
110110
-> f a
111111
-> m
112-
foldMapDefaultL f xs = foldl (\acc x -> f x <> acc) mempty xs
112+
foldMapDefaultL f = foldl (\acc x -> f x <> acc) mempty
113113

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

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

251251
-- | Find the sum of the numeric values in a data structure.
252252
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)