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 a function to map the effect list #37

Open
sjoerdvisscher opened this issue Dec 6, 2021 · 0 comments
Open

Add a function to map the effect list #37

sjoerdvisscher opened this issue Dec 6, 2021 · 0 comments

Comments

@sjoerdvisscher
Copy link

After a bit of refactoring some freer-simple related code I ended up with this function:

mapEffs :: (Union effs ~> Union effs') -> Eff effs ~> Eff effs'
mapEffs f = loop where
    loop = \case
        Val a -> pure a
        E u q -> E (f u) (tsingleton $ qComp q loop)

It seems this might a useful thing to add to the library. Note that I have no idea if this implementation is a good one (or even if it makes sense really.)

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

No branches or pull requests

1 participant