Skip to content

Commit

Permalink
Merge pull request #4 from mmhat/reuse-process-effect
Browse files Browse the repository at this point in the history
Reuse Process effect
  • Loading branch information
mmhat authored Apr 13, 2023
2 parents 9ab8c60 + 4cd31b6 commit a940771
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
22 changes: 13 additions & 9 deletions src/Effectful/Process/Typed.hs
Original file line number Diff line number Diff line change
Expand Up @@ -71,23 +71,27 @@ import System.Process.Typed as Reexport hiding
import Data.ByteString.Lazy (ByteString)
import qualified System.Process.Typed as PT

import Effectful.Internal.Effect
import Effectful.Internal.Monad
import Effectful (Dispatch(..), DispatchOf)
import Effectful.Dispatch.Static (SideEffects(..))
import Effectful
import qualified Effectful.Process
import Effectful.Dispatch.Static

#if ! MIN_VERSION_typed_process(0,2,8)
import System.Exit (ExitCode(..))
#endif

-- | An effect for running child processes using the @typed-process@ library.
data TypedProcess :: Effect
----------------------------------------
-- Effect & Handler

type instance DispatchOf TypedProcess = 'Static 'WithSideEffects
data instance StaticRep TypedProcess = TypedProcess
-- | We provide a type synonym for the 'Effectful.Process.Process' effect since
-- it clashes with 'PT.Process' type of @typed-process@.
type TypedProcess = Effectful.Process.Process

-- | This is merely an alias for 'Effectful.Process.runProcess' since that name
-- clashes with 'runProcess', i.e.:
--
-- > runTypedProcess = Effectful.Process.runProcess
runTypedProcess :: IOE :> es => Eff (TypedProcess : es) a -> Eff es a
runTypedProcess = evalStaticRep TypedProcess
runTypedProcess = Effectful.Process.runProcess

----------------------------------------
-- Launch a process
Expand Down
5 changes: 3 additions & 2 deletions typed-process-effectful.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ bug-reports:
https://github.com/haskell-effectful/typed-process-effectful/issues

author: Dominik Peteler
maintainer: Dominik Peteler
maintainer: hackage+typed-process-effectful@with-h.at
license: BSD-3-Clause
build-type: Simple
extra-source-files:
extra-doc-files:
CHANGELOG.md
LICENSE.md
README.md
Expand Down Expand Up @@ -53,6 +53,7 @@ library
build-depends:
, base >=4.14 && <5
, bytestring <0.12
, effectful >=2.0 && <2.3
, effectful-core >=2.0 && <2.3
, typed-process >=0.2.5 && <0.3

Expand Down

0 comments on commit a940771

Please sign in to comment.