sys-process 0.1.6 → 0.2.0
raw patch · 5 files changed
+76/−32 lines, 5 filesdep ~basedep ~notzerodep ~process
Dependency ranges changed: base, notzero, process, transformers
Files
- changelog +4/−0
- src/Sys/CreateProcess.hs +28/−22
- src/Sys/Exit.hs +2/−2
- src/Sys/StdStream.hs +37/−3
- sys-process.cabal +5/−5
changelog view
@@ -1,3 +1,7 @@+0.2.0++* Compatible with process 1.6.+ 0.1.6 * Explicit `NoImplicitPrelude` on source files (issue #1).
src/Sys/CreateProcess.hs view
@@ -27,6 +27,7 @@ import Sys.CmdSpec(CmdSpec, AsCmdSpec(_CmdSpec), AsExecutableName(_ExecutableName), AsExecutableArguments(_ExecutableArguments), AsShellCommand(_ShellCommand), AsRawCommand(_RawCommand)) import Sys.StdStream(StdStream, AsStdStream(_StdStream)) import System.FilePath(FilePath)+import System.Posix.Types(GroupID, UserID) import qualified System.Process as Process -- | Data type representing a process.@@ -43,6 +44,11 @@ Bool Bool Bool + Bool + Bool + Bool+ (Maybe GroupID) + (Maybe UserID) deriving (Eq, Show) -- | Types that related to @CreateProcess@.@@ -57,16 +63,16 @@ instance (Profunctor p, Functor f) => AsCreateProcess p f Process.CreateProcess where _CreateProcess = iso- (\(Process.CreateProcess s p e i o r d g c) ->- CreateProcess (from _CmdSpec # s) p e (from _StdStream # i) (from _StdStream # o) (from _StdStream # r) d g c)- (\(CreateProcess s p e i o r d g c) ->- Process.CreateProcess (_CmdSpec # s) p e (_StdStream # i) (_StdStream # o) (_StdStream # r) d g c)+ (\(Process.CreateProcess s p e i o r d g c x1 x2 x3 x4 x5) ->+ CreateProcess (from _CmdSpec # s) p e (from _StdStream # i) (from _StdStream # o) (from _StdStream # r) d g c x1 x2 x3 x4 x5)+ (\(CreateProcess s p e i o r d g c x1 x2 x3 x4 x5) ->+ Process.CreateProcess (_CmdSpec # s) p e (_StdStream # i) (_StdStream # o) (_StdStream # r) d g c x1 x2 x3 x4 x5) instance Functor f => AsCmdSpec (->) f CreateProcess where _CmdSpec = lens- (\(CreateProcess s _ _ _ _ _ _ _ _) -> s)- (\(CreateProcess _ p e i o r d g c) s -> CreateProcess s p e i o r d g c)+ (\(CreateProcess s _ _ _ _ _ _ _ _ _ _ _ _ _) -> s)+ (\(CreateProcess _ p e i o r d g c x1 x2 x3 x4 x5) s -> CreateProcess s p e i o r d g c x1 x2 x3 x4 x5) instance Applicative f => AsExecutableName (->) f CreateProcess where _ExecutableName =@@ -96,8 +102,8 @@ instance Functor f => AsWorkingDirectory (->) f CreateProcess where _WorkingDirectory = lens- (\(CreateProcess _ p _ _ _ _ _ _ _) -> p)- (\(CreateProcess s _ e i o r d g c) p -> CreateProcess s p e i o r d g c)+ (\(CreateProcess _ p _ _ _ _ _ _ _ _ _ _ _ _) -> p)+ (\(CreateProcess s _ e i o r d g c x1 x2 x3 x4 x5) p -> CreateProcess s p e i o r d g c x1 x2 x3 x4 x5) -- | Types that relate to an environment. class AsEnvironment p f s where@@ -111,8 +117,8 @@ instance Functor f => AsEnvironment (->) f CreateProcess where _Environment = lens- (\(CreateProcess _ _ e _ _ _ _ _ _) -> e)- (\(CreateProcess s p _ i o r d g c) e -> CreateProcess s p e i o r d g c)+ (\(CreateProcess _ _ e _ _ _ _ _ _ _ _ _ _ _) -> e)+ (\(CreateProcess s p _ i o r d g c x1 x2 x3 x4 x5) e -> CreateProcess s p e i o r d g c x1 x2 x3 x4 x5) -- | Types that relate to a standard input stream. class AsStdin p f s where@@ -126,8 +132,8 @@ instance Functor f => AsStdin (->) f CreateProcess where _Stdin = lens- (\(CreateProcess _ _ _ i _ _ _ _ _) -> i)- (\(CreateProcess s p e _ o r d g c) i -> CreateProcess s p e i o r d g c)+ (\(CreateProcess _ _ _ i _ _ _ _ _ _ _ _ _ _) -> i)+ (\(CreateProcess s p e _ o r d g c x1 x2 x3 x4 x5) i -> CreateProcess s p e i o r d g c x1 x2 x3 x4 x5) -- | Types that relate to a standard output stream. class AsStdout p f s where@@ -141,8 +147,8 @@ instance Functor f => AsStdout (->) f CreateProcess where _Stdout = lens- (\(CreateProcess _ _ _ _ o _ _ _ _) -> o)- (\(CreateProcess s p e i _ r d g c) o -> CreateProcess s p e i o r d g c)+ (\(CreateProcess _ _ _ _ o _ _ _ _ _ _ _ _ _) -> o)+ (\(CreateProcess s p e i _ r d g c x1 x2 x3 x4 x5) o -> CreateProcess s p e i o r d g c x1 x2 x3 x4 x5) -- | Types that relate to a standard error stream. class AsStderr p f s where@@ -156,8 +162,8 @@ instance Functor f => AsStderr (->) f CreateProcess where _Stderr = lens- (\(CreateProcess _ _ _ _ _ r _ _ _) -> r)- (\(CreateProcess s p e i o _ d g c) r -> CreateProcess s p e i o r d g c)+ (\(CreateProcess _ _ _ _ _ r _ _ _ _ _ _ _ _) -> r)+ (\(CreateProcess s p e i o _ d g c x1 x2 x3 x4 x5) r -> CreateProcess s p e i o r d g c x1 x2 x3 x4 x5) -- | Types that relate to closing descriptors. class AsCloseDescriptors p f s where@@ -171,8 +177,8 @@ instance Functor f => AsCloseDescriptors (->) f CreateProcess where _CloseDescriptors = lens- (\(CreateProcess _ _ _ _ _ _ d _ _) -> d)- (\(CreateProcess s p e i o r _ g c) d -> CreateProcess s p e i o r d g c)+ (\(CreateProcess _ _ _ _ _ _ d _ _ _ _ _ _ _) -> d)+ (\(CreateProcess s p e i o r _ g c x1 x2 x3 x4 x5) d -> CreateProcess s p e i o r d g c x1 x2 x3 x4 x5) -- | Types that relate to creating groups. class AsCreateGroup p f s where@@ -186,8 +192,8 @@ instance Functor f => AsCreateGroup (->) f CreateProcess where _CreateGroup = lens- (\(CreateProcess _ _ _ _ _ _ _ g _) -> g)- (\(CreateProcess s p e i o r d _ c) g -> CreateProcess s p e i o r d g c)+ (\(CreateProcess _ _ _ _ _ _ _ g _ _ _ _ _ _) -> g)+ (\(CreateProcess s p e i o r d _ c x1 x2 x3 x4 x5) g-> CreateProcess s p e i o r d g c x1 x2 x3 x4 x5) -- | Types that relate to delegating CTRL-C. class AsDelegateCtrlC p f s where@@ -201,5 +207,5 @@ instance Functor f => AsDelegateCtrlC (->) f CreateProcess where _DelegateCtrlC = lens- (\(CreateProcess _ _ _ _ _ _ _ _ c) -> c)- (\(CreateProcess s p e i o r d g _) c -> CreateProcess s p e i o r d g c)+ (\(CreateProcess _ _ _ _ _ _ _ _ c _ _ _ _ _) -> c)+ (\(CreateProcess s p e i o r d g _ x1 x2 x3 x4 x5) c -> CreateProcess s p e i o r d g c x1 x2 x3 x4 x5)
src/Sys/Exit.hs view
@@ -24,7 +24,7 @@ import Data.Foldable(Foldable, mapM_) import Data.Int(Int) import Data.NotZero(NotZero, notZero1)-import Data.NotZeroOr(NumberM, Number, NotZeroOrT(NotZeroOrT))+import Data.NotZeroOr(Number, NotZeroOrT(NotZeroOrT)) import Sys.Process as Process import Sys.ExitCode as ExitCode import qualified System.Exit as Exit@@ -93,7 +93,7 @@ exitWith exitSuccess type ExitCodeM f =- NumberM Int f+ NotZeroOrT Int f () exitCodeM :: f (Number Int)
src/Sys/StdStream.hs view
@@ -7,7 +7,8 @@ , AsStdStream(..) , AsInherit(..) , AsUseHandle(..)-, AsCreatePipe+, AsCreatePipe(..)+, AsNoStream(..) ) where import Control.Applicative(Applicative)@@ -27,6 +28,7 @@ -- @Handle@ will use the default encoding -- and newline translation mode (just -- like @Handle@s created by @openFile@).+ | NoStream deriving (Eq, Show) class AsStdStream p f s where@@ -46,14 +48,18 @@ Process.UseHandle h -> UseHandle h Process.CreatePipe ->- CreatePipe)+ CreatePipe+ Process.NoStream ->+ NoStream) (\s -> case s of Inherit -> Process.Inherit UseHandle h -> Process.UseHandle h CreatePipe ->- Process.CreatePipe)+ Process.CreatePipe+ NoStream ->+ Process.NoStream) class AsInherit p f s where _Inherit ::@@ -73,6 +79,8 @@ UseHandle _ -> Nothing CreatePipe ->+ Nothing+ NoStream -> Nothing) class AsUseHandle p f s where@@ -93,6 +101,8 @@ UseHandle h -> Just h CreatePipe ->+ Nothing+ NoStream -> Nothing) class AsCreatePipe p f s where@@ -113,4 +123,28 @@ UseHandle _ -> Nothing CreatePipe ->+ Just ()+ NoStream ->+ Nothing)++class AsNoStream p f s where+ _NoStream ::+ Optic' p f s ()++instance AsNoStream p f () where+ _NoStream =+ id++instance (Choice p, Applicative f) => AsNoStream p f StdStream where+ _NoStream =+ prism'+ (\() -> NoStream)+ (\s -> case s of+ Inherit -> + Nothing+ UseHandle _ ->+ Nothing+ CreatePipe ->+ Nothing+ NoStream -> Just ())
sys-process.cabal view
@@ -1,5 +1,5 @@ name: sys-process-version: 0.1.6+version: 0.2.0 license: BSD3 license-file: LICENSE author: Tony Morris <ʇǝu˙sıɹɹoɯʇ@ןןǝʞsɐɥ> <dibblego>@@ -29,15 +29,15 @@ Haskell2010 build-depends:- base >= 3 && < 5+ base >= 3 && <= 5 , mtl >= 2.0 && < 2.3 , semigroups >= 0.8 , semigroupoids >= 4.0 , bifunctors >= 3.0 , lens >= 4.0 && < 5- , transformers >= 0.3 && < 0.5- , process >= 1.2.3 && < 1.3- , notzero >= 0.0.10 && <= 0.1+ , transformers >= 0.3 && < 0.6+ , process >= 1.2.3 && < 1.7+ , notzero >= 0.0.11 && <= 0.1 , filepath >= 1.4 && < 2.0 , directory >= 1.2 && < 2.0