diff options
author | Herbert Valerio Riedel <hvr@gnu.org> | 2015-10-17 16:47:51 +0200 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2015-10-17 16:51:33 +0200 |
commit | e8ed2136feea75f4676eb6103acd5bb1bfe35281 (patch) | |
tree | 156daa80421dfdd923d3fa12c83809458f42d333 /compiler/llvmGen | |
parent | 40cbf9aaa16fd263c54e159a4bda3a5682720041 (diff) | |
download | haskell-e8ed2136feea75f4676eb6103acd5bb1bfe35281.tar.gz |
Make Monad/Applicative instances MRP-friendly
This patch refactors pure/(*>) and return/(>>) in MRP-friendly way, i.e.
such that the explicit definitions for `return` and `(>>)` match the
MRP-style default-implementation, i.e.
return = pure
and
(>>) = (*>)
This way, e.g. all `return = pure` definitions can easily be grepped and
removed in GHC 8.1;
Test Plan: Harbormaster
Reviewers: goldfire, alanz, bgamari, quchen, austin
Reviewed By: quchen, austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1312
Diffstat (limited to 'compiler/llvmGen')
-rw-r--r-- | compiler/llvmGen/LlvmCodeGen/Base.hs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/llvmGen/LlvmCodeGen/Base.hs b/compiler/llvmGen/LlvmCodeGen/Base.hs index 510d01f1d7..7a673b8ec3 100644 --- a/compiler/llvmGen/LlvmCodeGen/Base.hs +++ b/compiler/llvmGen/LlvmCodeGen/Base.hs @@ -208,11 +208,11 @@ instance Functor LlvmM where return (f x, env') instance Applicative LlvmM where - pure = return + pure x = LlvmM $ \env -> return (x, env) (<*>) = ap instance Monad LlvmM where - return x = LlvmM $ \env -> return (x, env) + return = pure m >>= f = LlvmM $ \env -> do (x, env') <- runLlvmM m env runLlvmM (f x) env' |