diff options
author | Herbert Valerio Riedel <hvr@gnu.org> | 2016-01-01 01:45:08 +0100 |
---|---|---|
committer | Herbert Valerio Riedel <hvr@gnu.org> | 2016-01-01 01:55:16 +0100 |
commit | dafeb51f266793a67e8ae18ae39a2e2e87943824 (patch) | |
tree | f1ef3abd7fc655e6b8896a6841f0efd9a39a39fe /libraries/base/Data/Semigroup.hs | |
parent | 8afeaad919dc67643b4eff14efafb48b59039b2b (diff) | |
download | haskell-dafeb51f266793a67e8ae18ae39a2e2e87943824.tar.gz |
Canonicalise `MonadPlus` instances
This refactoring exploits the fact that since AMP, in most cases,
`instance MonadPlus` can be automatically derived from the respective
`Alternative` instance. This is because `MonadPlus`'s default method
implementations are fully defined in terms of `Alternative(empty, (<>))`.
Diffstat (limited to 'libraries/base/Data/Semigroup.hs')
-rw-r--r-- | libraries/base/Data/Semigroup.hs | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/libraries/base/Data/Semigroup.hs b/libraries/base/Data/Semigroup.hs index 6fa0cd85d6..518e215661 100644 --- a/libraries/base/Data/Semigroup.hs +++ b/libraries/base/Data/Semigroup.hs @@ -592,9 +592,7 @@ instance Alternative Option where Option Nothing <|> b = b a <|> _ = a -instance MonadPlus Option where - mzero = Option Nothing - mplus = (<|>) +instance MonadPlus Option instance MonadFix Option where mfix f = Option (mfix (getOption . f)) |