Skip to content

Generic effect and interpose #150

Answered by arybczak
mkleczek asked this question in Q&A
Mar 31, 2023 · 1 comments · 3 replies
Discussion options

You must be logged in to vote

Yes, this works:

data MyEff a :: Effect where
  MyEff :: a -> MyEff a m ()
type instance DispatchOf (MyEff a) = Dynamic

tracedSql :: forall a es. (MyEff a :> es) => Eff es () -> Eff es ()
tracedSql = interpose @(MyEff a) $ \env (MyEff a) -> do
    send $ MyEff a

Plugin doesn't really help if there is no type annotation on interpose in this case for some reason, not sure exactly why.

EDIT: It doesn't help because the plugin disambiguates type variables of a particular effect, not effects themselves.

Replies: 1 comment 3 replies

Comment options

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

@arybczak
Comment options

Answer selected by mkleczek
@mkleczek
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
3 participants