-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Define Monoid instance for ReaderT #97
Conversation
here is Monoid instance in action |
ping |
src/Control/Monad/Reader/Trans.purs
Outdated
@@ -72,6 +74,12 @@ instance monadReaderT :: Monad m => Monad (ReaderT r m) | |||
|
|||
instance monadZeroReaderT :: MonadZero m => MonadZero (ReaderT r m) | |||
|
|||
instance semigroupReaderT :: (Monad m, Semigroup a) => Semigroup (ReaderT s m a) where |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only need Apply
here, not a full Monad
.
src/Control/Monad/Reader/Trans.purs
Outdated
instance semigroupReaderT :: (Monad m, Semigroup a) => Semigroup (ReaderT s m a) where | ||
append = lift2 (<>) | ||
|
||
instance monoidReaderT :: (Monad m, Monoid a) => Monoid (ReaderT s m a) where |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only needs Applicative
.
src/Control/Monad/Reader/Trans.purs
Outdated
@@ -20,6 +20,8 @@ import Control.Monad.Trans.Class (class MonadTrans, lift) | |||
import Control.Monad.Writer.Class (class MonadWriter, class MonadTell, pass, listen, tell) | |||
import Control.MonadPlus (class MonadPlus) | |||
import Control.MonadZero (class MonadZero) | |||
import Data.Monoid (class Monoid, mempty) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please keep the sorting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Thanks! |
No description provided.