Skip to content
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

Merged
merged 3 commits into from
Jun 3, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/Control/Monad/Reader/Trans.purs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep the sorting

import Control.Apply (lift2)
import Control.Plus (class Plus, empty)

import Data.Distributive (class Distributive, distribute, collect)
Expand Down Expand Up @@ -72,6 +74,12 @@ instance monadReaderT :: Monad m => Monad (ReaderT r m)

instance monadZeroReaderT :: MonadZero m => MonadZero (ReaderT r m)

instance semigroupReaderT :: (Apply m, Semigroup a) => Semigroup (ReaderT s m a) where
append = lift2 (<>)

instance monoidReaderT :: (Applicative m, Monoid a) => Monoid (ReaderT s m a) where
mempty = pure mempty

instance monadPlusReaderT :: MonadPlus m => MonadPlus (ReaderT r m)

instance monadTransReaderT :: MonadTrans (ReaderT r) where
Expand Down