Skip to content

Commit 79a3a02

Browse files
committed
Merge pull request #9 from hdgarrood/master
Fix Invariant Maybe instance name
2 parents f207b2f + be4cbb4 commit 79a3a02

File tree

4 files changed

+24
-24
lines changed

4 files changed

+24
-24
lines changed

docs/Data.Maybe.First.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ newtype First a
77
= First (Maybe a)
88
```
99

10+
Monoid returning the first (left-most) non-`Nothing` value.
11+
12+
``` purescript
13+
First (Just x) <> First (Just y) == First (Just x)
14+
First Nothing <> First (Just y) == First (Just y)
15+
First Nothing <> Nothing == First Nothing
16+
mempty :: First _ == First Nothing
17+
```
18+
1019
##### Instances
1120
``` purescript
1221
instance eqFirst :: (Eq a) => Eq (First a)
@@ -24,15 +33,6 @@ instance semigroupFirst :: Semigroup (First a)
2433
instance monoidFirst :: Monoid (First a)
2534
```
2635

27-
Monoid returning the first (left-most) non-`Nothing` value.
28-
29-
``` purescript
30-
First (Just x) <> First (Just y) == First (Just x)
31-
First Nothing <> First (Just y) == First (Just y)
32-
First Nothing <> Nothing == First Nothing
33-
mempty :: First _ == First Nothing
34-
```
35-
3636
#### `runFirst`
3737

3838
``` purescript

docs/Data.Maybe.Last.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ newtype Last a
77
= Last (Maybe a)
88
```
99

10+
Monoid returning the last (right-most) non-`Nothing` value.
11+
12+
``` purescript
13+
Last (Just x) <> Last (Just y) == Last (Just y)
14+
Last (Just x) <> Nothing == Last (Just x)
15+
Last Nothing <> Nothing == Last Nothing
16+
mempty :: Last _ == Last Nothing
17+
```
18+
1019
##### Instances
1120
``` purescript
1221
instance eqLast :: (Eq a) => Eq (Last a)
@@ -24,15 +33,6 @@ instance semigroupLast :: Semigroup (Last a)
2433
instance monoidLast :: Monoid (Last a)
2534
```
2635

27-
Monoid returning the last (right-most) non-`Nothing` value.
28-
29-
``` purescript
30-
Last (Just x) <> Last (Just y) == Last (Just y)
31-
Last (Just x) <> Nothing == Last (Just x)
32-
Last Nothing <> Nothing == Last Nothing
33-
mempty :: Last _ == Last Nothing
34-
```
35-
3636
#### `runLast`
3737

3838
``` purescript

docs/Data.Maybe.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ data Maybe a
88
| Just a
99
```
1010

11+
The `Maybe` type is used to represent optional values and can be seen as
12+
something like a type-safe `null`, where `Nothing` is `null` and `Just x`
13+
is the non-null value `x`.
14+
1115
##### Instances
1216
``` purescript
1317
instance functorMaybe :: Functor Maybe
@@ -20,7 +24,7 @@ instance bindMaybe :: Bind Maybe
2024
instance monadMaybe :: Monad Maybe
2125
instance monadPlusMaybe :: MonadPlus Maybe
2226
instance extendMaybe :: Extend Maybe
23-
instance invariantFirst :: Invariant Maybe
27+
instance invariantMaybe :: Invariant Maybe
2428
instance semigroupMaybe :: (Semigroup a) => Semigroup (Maybe a)
2529
instance monoidMaybe :: (Semigroup a) => Monoid (Maybe a)
2630
instance semiringMaybe :: (Semiring a) => Semiring (Maybe a)
@@ -36,10 +40,6 @@ instance booleanAlgebraMaybe :: (BooleanAlgebra a) => BooleanAlgebra (Maybe a)
3640
instance showMaybe :: (Show a) => Show (Maybe a)
3741
```
3842

39-
The `Maybe` type is used to represent optional values and can be seen as
40-
something like a type-safe `null`, where `Nothing` is `null` and `Just x`
41-
is the non-null value `x`.
42-
4343
#### `maybe`
4444

4545
``` purescript

src/Data/Maybe.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ instance extendMaybe :: Extend Maybe where
189189
extend _ Nothing = Nothing
190190
extend f x = Just (f x)
191191

192-
instance invariantFirst :: Invariant Maybe where
192+
instance invariantMaybe :: Invariant Maybe where
193193
imap = imapF
194194

195195
-- | The `Semigroup` instance enables use of the operator `<>` on `Maybe` values

0 commit comments

Comments
 (0)