Skip to content

How do I use localSeqUnlift with reinterpret? #159

Answered by arybczak
ocharles asked this question in Q&A
Discussion options

You must be logged in to vote

Ah ok, I see it now.

I got rid of the irrelevant bits and this compiles:

import Effectful
import Effectful.Dispatch.Dynamic
import Effectful.Fail

data Statement :: Effect
runStatement :: Eff (Statement : es) a -> Eff es a
runStatement = undefined

data RNG :: Effect
runRNG :: Eff (RNG : es) a -> Eff es a
runRNG = undefined

data DB :: Effect where
  RunTransaction :: Eff [Statement, RNG, Fail] a -> DB m a
type instance DispatchOf DB = Dynamic

runDB :: IOE :> es => Eff (DB : es) a -> Eff es a
runDB = reinterpret (runFailIO . runRNG . runStatement) interpreter
  where
    interpreter
      :: ( IOE :> handlerEs
         , Statement :> handlerEs
         , RNG :> handlerEs
         , Fail :> 

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@arybczak
Comment options

Answer selected by ocharles
@ocharles
Comment options

@arybczak
Comment options

@ocharles
Comment options

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