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

MonadRec instance for ReaderT #55

Merged
merged 3 commits into from
Sep 3, 2015

Conversation

ethul
Copy link
Contributor

@ethul ethul commented Sep 3, 2015

Adding a MonadRec instance

@@ -96,3 +100,12 @@ instance monadWriterReaderT :: (Monad m, MonadWriter w m) => MonadWriter w (Read
instance distributiveReaderT :: (Distributive g) => Distributive (ReaderT e g) where
distribute a = ReaderT \e -> collect (flip runReaderT e) a
collect f = distribute <<< map f

instance monadRecReaderT :: (MonadRec m) => MonadRec (ReaderT r m) where
tailRecM k a = ReaderT \r -> tailRecM k' (Tuple a r)
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think you need to tuple up the state here. You can just pass in r as it doesn't change.

@ethul
Copy link
Contributor Author

ethul commented Sep 3, 2015

You're right. I've updated the instance. Thanks!

paf31 added a commit that referenced this pull request Sep 3, 2015
@paf31 paf31 merged commit a4aa3a3 into purescript:master Sep 3, 2015
@paf31
Copy link
Contributor

paf31 commented Sep 3, 2015

👍 Thanks!

@ethul
Copy link
Contributor Author

ethul commented Sep 3, 2015

Thanks for the merge!

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

2 participants