Wrapping an Impure Library API with Effect in TypeScript

I'm working with an impure library API which looks like this:

CodeBlockWriter.indent(block: () => void): CodeBlockWriter


The expectation is that you do effectful stuff with the instance of CodeBlockWriter that you're working with inside of the block.

How can I wrap this so that I have a function that looks (something) like the following?

codeBlockWriterIndent(writer: CodeBlockWriter, block: Effect.Effect<void>): Effect.Effect<CodeBlockWriter> 
Was this page helpful?