Skip to content

Commit b78319b

Browse files
committed
Fix traversable Sup and Inf
1 parent a0d111b commit b78319b

File tree

3 files changed

+28
-12
lines changed

3 files changed

+28
-12
lines changed

docs/Data.Foldable.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,31 +66,31 @@ instance foldableFirst :: Foldable First
6666
```
6767

6868

69-
#### `foldableLast`
69+
#### `foldableInf`
7070

7171
``` purescript
72-
instance foldableLast :: Foldable Last
72+
instance foldableInf :: Foldable Inf
7373
```
7474

7575

76-
#### `foldableSup`
76+
#### `foldableLast`
7777

7878
``` purescript
79-
instance foldableSup :: Foldable Sup
79+
instance foldableLast :: Foldable Last
8080
```
8181

8282

83-
#### `foldableInf`
83+
#### `foldableMultiplicative`
8484

8585
``` purescript
86-
instance foldableInf :: Foldable Inf
86+
instance foldableMultiplicative :: Foldable Multiplicative
8787
```
8888

8989

90-
#### `foldableMultiplicative`
90+
#### `foldableSup`
9191

9292
``` purescript
93-
instance foldableMultiplicative :: Foldable Multiplicative
93+
instance foldableSup :: Foldable Sup
9494
```
9595

9696

docs/Data.Traversable.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,13 @@ instance traversableFirst :: Traversable First
7878
```
7979

8080

81+
#### `traversableInf`
82+
83+
``` purescript
84+
instance traversableInf :: Traversable Inf
85+
```
86+
87+
8188
#### `traversableLast`
8289

8390
``` purescript
@@ -92,6 +99,13 @@ instance traversableMultiplicative :: Traversable Multiplicative
9299
```
93100

94101

102+
#### `traversableSup`
103+
104+
``` purescript
105+
instance traversableSup :: Traversable Sup
106+
```
107+
108+
95109
#### `for`
96110

97111
``` purescript

src/Data/Traversable.purs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ import Data.Maybe (Maybe (..))
1717
import Data.Monoid.Additive (Additive(..))
1818
import Data.Monoid.Dual (Dual(..))
1919
import Data.Monoid.First (First(..))
20+
import Data.Monoid.Inf (Inf(..))
2021
import Data.Monoid.Last (Last(..))
2122
import Data.Monoid.Multiplicative (Multiplicative(..))
23+
import Data.Monoid.Sup (Sup(..))
2224
import Data.Tuple (Tuple(..), fst, snd)
2325

2426
-- | `Traversable` represents data structures which can be _traversed_,
@@ -78,8 +80,8 @@ instance traversableFirst :: Traversable First where
7880
sequence (First x) = First <$> sequence x
7981

8082
instance traversableInf :: Traversable Inf where
81-
traverse f (Inf x) = Inf <$> traverse f x
82-
sequence (Inf x) = Inf <$> sequence x
83+
traverse f (Inf x) = Inf <$> f x
84+
sequence (Inf x) = Inf <$> x
8385

8486
instance traversableLast :: Traversable Last where
8587
traverse f (Last x) = Last <$> traverse f x
@@ -90,8 +92,8 @@ instance traversableMultiplicative :: Traversable Multiplicative where
9092
sequence (Multiplicative x) = Multiplicative <$> x
9193

9294
instance traversableSup :: Traversable Sup where
93-
traverse f (Sup x) = Sup <$> traverse f x
94-
sequence (Sup x) = Sup <$> sequence x
95+
traverse f (Sup x) = Sup <$> f x
96+
sequence (Sup x) = Sup <$> x
9597

9698
-- | A version of `traverse` with its arguments flipped.
9799
-- |

0 commit comments

Comments
 (0)