Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider adding a dynamic effect #12

Open
tbidne opened this issue Nov 26, 2024 · 0 comments
Open

Consider adding a dynamic effect #12

tbidne opened this issue Nov 26, 2024 · 0 comments

Comments

@tbidne
Copy link

tbidne commented Nov 26, 2024

Hello, thanks for the nice library.

Recently I had cause to use a dynamic variant of the typed-process effect. In particular, I had a test suite that relied on mocking, so I ended up with something like:

runTypedProcessMock :: Eff (TypedProcess : es) a -> Eff es a
runTypedProcessMock = interpret_ $ \case
  -- processConfigToCmd :: ProcessConfig i o e -> String
  ReadProcess pc -> case processConfigToCmd pc of
     "expected_cmd" -> pure (ExitSuccess, "expected output", "")
  ...

This, of course, relies on having a dynamic TypedProcess, as opposed to the static one. Do you have any interest in me upstreaming this here? The code is a straightforward translation of the static module, so I don't think it will add much of a maintenance burden. If so, I'll open a PR. If not, no worries, I'll continue to use my local implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant