-
Notifications
You must be signed in to change notification settings - Fork 28
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 some more interpretation functions #230
Conversation
This adds some more interpretation functions that are useful for - Postfix handling of effects - Handling of first-order effects that don't use the environment
Since the suffix
(`interpret` myFunction arg) $ \_ -> \case
NotifyA i -> ...
NotifyB s -> ... ? Maybe it's enough to add demonstration of this syntax to haddock of these functions? |
Yeah, I agree that
That's true, I don't know how much you care that people would need to use this qualified. I do think it's a pretty natural name: people talk about "effect handlers" all the time, I think you have a good claim to it. I would rather have the good name and have to use it qualified, personally.
I could do that, yeah. But I really don't want to. I think that's much worse for readers of my code than the version with |
Could change |
I also don't think |
I guess
I tried hard to make the API not clash with typically used modules/libraries, so it would be a shame to lose this. How about myFunction arg `interpretWith_` $ \case
NotifyA i -> ...
NotifyB s -> ... |
I like that! |
Closing in favour of #231 |
This adds some more interpretation functions that are useful for
We have these defined in our local codebase and they're quite nice.
handle
style is nice for effects that don't have a global interpreter but are interpreted specifically at the use site.As an example of these together, we sometimes use
effectful
to as a fancy way of defining callbacks for a function, like so: