Skip to content

difficulty with a polymorphic effect handler #488

Answered by TimWhiting
mccraigmccraig asked this question in Q&A
Discussion options

You must be logged in to vote

I haven't looked at it too closely, but the following two alternatives type-check fine:

Most likely you are trying to resume after running this part of the chain, but as written your operations do not resume. You can either add the resume, or swap ctl and resume for a fun operation since it is tail resumptive. Note that you can use the more restrictive fun operation here even if you want to keep the effect itself more flexible by allowing any ctl operation.

pub fun run-chain-io-handler<i,d,o,v,e>(action: () -> <computation-io<i,d,o,v,e>,pure,logger|e> v): <pure,logger|e> v
  with handler 
    ctl inputs-fx(c, i)
      resume(run-chain(c.input-chain, i))
    ctl outputs-fx(c, o)
      resu…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@mccraigmccraig
Comment options

Answer selected by mccraigmccraig
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants