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

Conversation

safareli
Copy link
Contributor

No description provided.

@safareli
Copy link
Contributor Author

here is Monoid instance in action

@safareli
Copy link
Contributor Author

safareli commented May 2, 2017

ping

@@ -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
Copy link
Contributor

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.

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
Copy link
Contributor

Choose a reason for hiding this comment

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

only needs Applicative.

@@ -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

Copy link
Member

@kritzcreek kritzcreek left a comment

Choose a reason for hiding this comment

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

Looks good!

@paf31 paf31 merged commit 5b9908e into purescript:master Jun 3, 2017
@paf31
Copy link
Contributor

paf31 commented Jun 3, 2017

Thanks!

@safareli safareli deleted the readermonoid branch June 4, 2017 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants