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

Add mapInputT_ #179

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Add mapInputT_ #179

wants to merge 2 commits into from

Conversation

janmasrovira
Copy link

@janmasrovira janmasrovira commented May 25, 2023

This PR adds a variation of mapInputT that only works on the unit type.

mapInputT_ :: (m () -> m ()) -> InputT m () -> InputT m ()
mapInputT_ f = InputT . mapReaderT (mapReaderT (mapReaderT
                                  (mapReaderT (mapReaderT f))))
                    . unInputT

Note that mapInputT_ cannot be implemented in terms of mapInputT because of the forall b quantifier inside the first argument of mapInputT. Thus, it makes sense to also export mapInputT_, since there are cases in which it can be useful.

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.

1 participant