diff options
author | Herbert Valerio Riedel <hvr@gnu.org> | 2015-02-08 20:56:58 +0100 |
---|---|---|
committer | Herbert Valerio Riedel <hvr@gnu.org> | 2015-02-09 10:05:59 +0100 |
commit | a741e69a230eb6d6e3373ad1fbe53c73b5f95077 (patch) | |
tree | 16789eb1edbff08eddde495e371a3893154adfa1 /compiler/basicTypes/OccName.hs | |
parent | 9bc13c0705fbc08989eb9f51dd8691dadc855747 (diff) | |
download | haskell-a741e69a230eb6d6e3373ad1fbe53c73b5f95077.tar.gz |
Provide default implementation of `Monad(return)`
This was dropped last-minute from d94de87252d0fe2ae97341d186b03a2fbe136b04
(re #4834) together with the default implementation for `(>>)`
(see 65f887e1a0d864526f6a2609a3afc2c151c25e38 for explanation).
However, the risk of accidental mutually recursive definitions of
`return`/`pure` is rather low as unlike with the `(>>) = (*>)` default,
any cyclic definitions would necessarily wind up being new ones, rather
than changing the semantics for old operations and introducing bottoms.
On the other hand, not having the default method implementation in place
in GHC 7.10 would complicate/delay any future attempt to clean-up the
`Monad`-class.
This finally allows (for `base >= 4.8`) to define a F/A/M instance-chain
with the following minimal definitions (while ignoring that `return` is
still a class-method in `Monad`)
instance Functor M where
fmap = ...
instance Applicative M where
pure = ...
(<*>) = ...
instance Monad M where
(>>=) = ...
Reviewed By: ekmett, austin
Differential Revision: https://phabricator.haskell.org/D647
Diffstat (limited to 'compiler/basicTypes/OccName.hs')
0 files changed, 0 insertions, 0 deletions