Skip to content
Discussion options

You must be logged in to vote

Not sure, but for your use case (as I understand it) the Labeled effect might be useful:

{-# LANGUAGE GHC2021 #-} {-# LANGUAGE AllowAmbiguousTypes #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE OverloadedStrings #-} module ByteWriter where import Prelude import Data.ByteString.Builder (Builder) import Effectful import Effectful.Labeled (Labeled, labeled, runLabeled) import Effectful.Writer.Static.Local (Writer, runWriter, tell) type ByteWriter tag = Labeled tag (Writer Builder) runByteWriter :: Eff (ByteWriter tag ': es) a -> Eff es (a, Builder) runByteWriter = runLabeled runWriter writeBytes :: forall tag es. (ByteWriter tag :> es) => Builder -> Eff es () writeBytes builder = labeled @t…

Replies: 2 comments 1 reply

Comment options

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

Answer selected by ruifengx
Comment options

You must be logged in to vote
0 replies
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