Refactoring Code to Use Direct Dependencies in Functions

I'm brainfarting I think - trying to convert some code I wrote when new to Effect into a less class oriented structure.

Converting a class that took services in its constructor to instead depend on the services directly in the function body. but now I'm drawing blanks on how I provide those deps at the layer level.

export const PythonEngineLive = Layer.succeed(PythonEngine, {
  type: 'python',
  group: 'python',
  execute: <T extends Calculation>(code: Statement, params: T) =>
    execute(code, params),
})


Ideally I'd just pass execute directly without the extra invocation - but I can't use pipe on the function.

I don't actually have to move the implementation of execute into this Layer right? I want to use the same implementation in other places (with different configuration)
image.png
Was this page helpful?