Skip to content
Discussion options

You must be logged in to vote

But I want to make sure my use of localSeqUnlift is sound.

Not quite. It will break as soon as you try to use properly local effects, because then your code will attempt to run them after they went out of scope.

test :: (Staged String :> es, Writer [String] :> es, Reader String :> es) => Eff es Int
test = do
  send (Tell @String "x")
  send (Ask $ \(s :: String) -> ask >>= \z -> tell [s, z])
  send (Tell @String "y")
  pure 0
>>> runPureEff (runWriter @[String] (runStaged @String $ runReader @String "z" test))
*** Exception: version (4) /= storageVersion (0)
If you're attempting to run an unlifting function outside of the scope of effects it captures, have a look at UnliftStrategy (SeqF…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@ruifengx
Comment options

@ruifengx
Comment options

@ruifengx
Comment options

Answer selected by ruifengx
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