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

How to use the (MonadBaseControl IO) instance of Snap? #309

Open
complyue opened this issue Jun 21, 2021 · 0 comments
Open

How to use the (MonadBaseControl IO) instance of Snap? #309

complyue opened this issue Jun 21, 2021 · 0 comments

Comments

@complyue
Copy link

Naively I tried liftBaseWith in a Snap action but inner writeText produces no effect at all.

I'm not sure I used MonadBaseControl correctly, but I failed to find a user side example on Github (as there're only instance impl. hits).

And quoting fpco/unliftio#17 (comment)

Continuation-based monads cannot have instances of MonadUnliftIO, the same as MonadBaseControl and MonadMask.

Am I right to see Snap as a "continuation-based" monad? If so, is the MonadBaseControl instance flawed or wrong at all?

Basically, I need to escape from Snap into nested IO, to run some scripting code leveraging STM, where I want to perform writeText etc. by the scripts to generate proper http payload. Ideally I want to wrap the full set of Snap API available for scripting, how can I do that?

I'd like to contribute some new public API if that's lacking and doable, but need some guidance and esp. a confirmation before heading that way.

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