Skip to content

Commit

Permalink
Merge pull request #9 from hdgarrood/master
Browse files Browse the repository at this point in the history
Fix Invariant Maybe instance name
  • Loading branch information
garyb committed Jul 2, 2015
2 parents f207b2f + be4cbb4 commit 79a3a02
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
18 changes: 9 additions & 9 deletions docs/Data.Maybe.First.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ newtype First a
= First (Maybe a)
```

Monoid returning the first (left-most) non-`Nothing` value.

``` purescript
First (Just x) <> First (Just y) == First (Just x)
First Nothing <> First (Just y) == First (Just y)
First Nothing <> Nothing == First Nothing
mempty :: First _ == First Nothing
```

##### Instances
``` purescript
instance eqFirst :: (Eq a) => Eq (First a)
Expand All @@ -24,15 +33,6 @@ instance semigroupFirst :: Semigroup (First a)
instance monoidFirst :: Monoid (First a)
```

Monoid returning the first (left-most) non-`Nothing` value.

``` purescript
First (Just x) <> First (Just y) == First (Just x)
First Nothing <> First (Just y) == First (Just y)
First Nothing <> Nothing == First Nothing
mempty :: First _ == First Nothing
```

#### `runFirst`

``` purescript
Expand Down
18 changes: 9 additions & 9 deletions docs/Data.Maybe.Last.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ newtype Last a
= Last (Maybe a)
```

Monoid returning the last (right-most) non-`Nothing` value.

``` purescript
Last (Just x) <> Last (Just y) == Last (Just y)
Last (Just x) <> Nothing == Last (Just x)
Last Nothing <> Nothing == Last Nothing
mempty :: Last _ == Last Nothing
```

##### Instances
``` purescript
instance eqLast :: (Eq a) => Eq (Last a)
Expand All @@ -24,15 +33,6 @@ instance semigroupLast :: Semigroup (Last a)
instance monoidLast :: Monoid (Last a)
```

Monoid returning the last (right-most) non-`Nothing` value.

``` purescript
Last (Just x) <> Last (Just y) == Last (Just y)
Last (Just x) <> Nothing == Last (Just x)
Last Nothing <> Nothing == Last Nothing
mempty :: Last _ == Last Nothing
```

#### `runLast`

``` purescript
Expand Down
10 changes: 5 additions & 5 deletions docs/Data.Maybe.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ data Maybe a
| Just a
```

The `Maybe` type is used to represent optional values and can be seen as
something like a type-safe `null`, where `Nothing` is `null` and `Just x`
is the non-null value `x`.

##### Instances
``` purescript
instance functorMaybe :: Functor Maybe
Expand All @@ -20,7 +24,7 @@ instance bindMaybe :: Bind Maybe
instance monadMaybe :: Monad Maybe
instance monadPlusMaybe :: MonadPlus Maybe
instance extendMaybe :: Extend Maybe
instance invariantFirst :: Invariant Maybe
instance invariantMaybe :: Invariant Maybe
instance semigroupMaybe :: (Semigroup a) => Semigroup (Maybe a)
instance monoidMaybe :: (Semigroup a) => Monoid (Maybe a)
instance semiringMaybe :: (Semiring a) => Semiring (Maybe a)
Expand All @@ -36,10 +40,6 @@ instance booleanAlgebraMaybe :: (BooleanAlgebra a) => BooleanAlgebra (Maybe a)
instance showMaybe :: (Show a) => Show (Maybe a)
```

The `Maybe` type is used to represent optional values and can be seen as
something like a type-safe `null`, where `Nothing` is `null` and `Just x`
is the non-null value `x`.

#### `maybe`

``` purescript
Expand Down
2 changes: 1 addition & 1 deletion src/Data/Maybe.purs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ instance extendMaybe :: Extend Maybe where
extend _ Nothing = Nothing
extend f x = Just (f x)

instance invariantFirst :: Invariant Maybe where
instance invariantMaybe :: Invariant Maybe where
imap = imapF

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

0 comments on commit 79a3a02

Please sign in to comment.