Skip to content

Help with Event Effect #156

Answered by arybczak
dark-ether asked this question in Q&A
Apr 26, 2023 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

You need raiseWith:

runEvent ::forall e es a. Eff (Event e ': es) a -> Eff es a
runEvent = reinterpret (evalState ([]::[e -> Eff es ()])) $ \env -> \case
  (RegisterHandler act) -> raiseWith SeqUnlift $ \lower -> do
    localUnlift env (ConcUnlift Persistent Unlimited) $ \unlift -> lower $ do
      modify ((unlift . act) :)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@dark-ether
Comment options

Answer selected by dark-ether
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