-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Micro-optics for the process library -- -- 'microlens-process' is a set of multi-purpose optics and convenience -- combinators for working with the process library, including a -- more well-typed api for the parts that can be typed. @package microlens-process @version 0.2.0.2 -- | This module provides the associated optics and combinators for working -- with CmdSpec objects. CmdSpec consists of two cases: a -- Shell command, which is a command to execute naively in the shell, and -- a Raw command which is a command path together with its arguments. -- -- CmdSpec has two cases, and therefore a Traversal into -- those two cases. There is also a convenient Traversal available -- for working with the arglist of a Raw command and combinators for -- working with arguments monoidally. -- -- We provide classy variants for all useful traversals module System.Process.Microlens.CmdSpec -- | A Traversal' into the RawCommand case of a -- CmdSpec -- -- Examples: -- --
-- >>> RawCommand "/bin/ls" ["-l"] ^? _RawCommand
-- Just ("/bin/ls",["-l"])
--
--
-- -- >>> RawCommand "/bin/ls" ["-l"] ^? _ShellCommand -- Nothing ---- --
-- >>> RawCommand "/bin/ls" ["-l"] ^. _RawCommand . _1 -- "/bin/ls" ---- --
-- >>> RawCommand "/bin/ls" ["-l"] ^. _RawCommand . _2 -- ["-l"] --_RawCommand :: Traversal' CmdSpec (FilePath, [String]) -- | A Traversal' into the ShellCommand case of a -- CmdSpec -- -- Examples: -- --
-- >>> ShellCommand "ls -l" ^? _ShellCommand -- Just "ls -l" ---- --
-- >>> RawCommand "/bin/ls" ["-l"] ^? _ShellCommand -- Nothing --_ShellCommand :: Traversal' CmdSpec String -- | Traversal' into the arguments of a command -- -- Examples: -- --
-- >>> RawCommand "/bin/ls" ["-l"] ^. arguments -- ["-l"] --arguments :: Traversal' CmdSpec [String] -- | Classy Traversal' into the shell command of a CmdSpec class IsShell a _Shell :: IsShell a => Traversal' a String -- | Classy Traversal' into the raw command of a CmdSpec class IsRaw a _Raw :: IsRaw a => Traversal' a (FilePath, [String]) -- | Append an argument to the argument list of a RawCommand -- -- Examples: -- --
-- >>> arguing "-h" $ RawCommand "/bin/ls" ["-l"] -- RawCommand "/bin/ls" ["-l","-h"] ---- --
-- >>> arguing "-h" (RawCommand "/bin/ls" ["-l"]) ^. arguments -- ["-l","-h"] --arguing :: String -> CmdSpec -> CmdSpec instance System.Process.Microlens.CmdSpec.IsRaw System.Process.Common.CmdSpec instance System.Process.Microlens.CmdSpec.IsShell System.Process.Common.CmdSpec -- | This module provides the associated optics and combinators for working -- with CreateProcess objects. -- -- Because CreateProcess was created before the `_` prefix record -- name convention, some record accessors don't have an apparently "good" -- name for their corresponding lens. Those that do not are post-fixed -- with `_`. Thankfully, there are 6 that meet the criteria: -- cmdspec_, env_, cwd_, stdin_, -- stdout_, and stderr_. -- -- We provide classy variants of what we consider the significant -- portions of CreateProcess - namely, the std_in, -- std_out, and std_err entries. module System.Process.Microlens.CreateProcess -- | Lens into the cmdspec entry of the CreateProcess record cmdspec_ :: Lens' CreateProcess CmdSpec -- | Lens into the cwd entry of the CreateProcess record cwd_ :: Lens' CreateProcess (Maybe FilePath) -- | Lens into the env entry of the CreateProcess record env_ :: Lens' CreateProcess (Maybe [(String, String)]) -- | Lens into the std_in entry of the CreateProcess record stdin_ :: Lens' CreateProcess StdStream -- | Lens into the std_out entry of the CreateProcess record stdout_ :: Lens' CreateProcess StdStream -- | Lens into the std_err entry of the CreateProcess record stderr_ :: Lens' CreateProcess StdStream -- | Lens into the close_fds entry of the CreateProcess -- record closefds :: Lens' CreateProcess Bool -- | Lens into the create_group entry of the CreateProcess -- record creategroup :: Lens' CreateProcess Bool -- | Lens into the delegate_ctlc entry of the CreateProcess -- record delegatectlc :: Lens' CreateProcess Bool -- | Lens into the new_session entry of the CreateProcess -- record newsession :: Lens' CreateProcess Bool -- | Lens into the detach_console entry of the CreateProcess -- record detachconsole :: Lens' CreateProcess Bool -- | Lens into the create_new_console entry of the -- CreateProcess record createnewconsole :: Lens' CreateProcess Bool -- | Lens into the child_group entry of the CreateProcess -- record childgroup :: Lens' CreateProcess (Maybe CGid) -- | Lens into the child_user entry of the CreateProcess -- record childuser :: Lens' CreateProcess (Maybe CUid) -- | Lens into the use_process_jobs entry of the -- CreateProcess record useprocessjobs :: Lens' CreateProcess Bool -- | Classy lens for types with a stdin class HasStdin a _Stdin :: HasStdin a => Lens' a StdStream -- | Classy lens for types with a stdout class HasStdout a _Stdout :: HasStdout a => Lens' a StdStream -- | Classy lens for types with a stderr class HasStderr a _Stderr :: HasStderr a => Lens' a StdStream instance System.Process.Microlens.CreateProcess.HasStderr System.Process.Common.StdStream instance System.Process.Microlens.CreateProcess.HasStderr System.Process.Common.CreateProcess instance System.Process.Microlens.CreateProcess.HasStdout System.Process.Common.StdStream instance System.Process.Microlens.CreateProcess.HasStdout System.Process.Common.CreateProcess instance System.Process.Microlens.CreateProcess.HasStdin System.Process.Common.StdStream instance System.Process.Microlens.CreateProcess.HasStdin System.Process.Common.CreateProcess -- | Convenient data type with associated optics + isos for working with -- the output of a createProcess call. module System.Process.Microlens.ProcessHandler -- | A convenient handler for the output of a createProcess call. data ProcessHandler ProcessHandler :: Maybe Handle -> Maybe Handle -> Maybe Handle -> ProcessHandle -> ProcessHandler -- | a handle to stdin if it was requested [_hstdin] :: ProcessHandler -> Maybe Handle -- | a handle to stdout if it was requested [_hstdout] :: ProcessHandler -> Maybe Handle -- | a handle to stderr if it was requested [_hstderr] :: ProcessHandler -> Maybe Handle -- | a process handle, containing a pid lock, information regarding ctcl-c -- delegation, and closed/open handle status info. [_hhandle] :: ProcessHandler -> ProcessHandle -- | A lens into the stdin handle if requested hstdin :: Lens' ProcessHandler (Maybe Handle) -- | A lens into the stdout handle if requested hstdout :: Lens' ProcessHandler (Maybe Handle) -- | A lens into the stderr handle if requested hstderr :: Lens' ProcessHandler (Maybe Handle) -- | A lens into the process handle hhandle :: Lens' ProcessHandler ProcessHandle -- | An isomorphism between a ProcessHandler and its tuple -- representation _Handler :: Lens' ProcessHandler (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle) -- | A default for a CreateProcess defaultCreateProcess :: CreateProcess -- | This module provides the associated optics and combinators for working -- with StdStream objects. StdStream consists of four -- cases, for which we provide traversals for each case module System.Process.Microlens.StdStream -- | A Traversal' into the Inherit structure of a -- StdStream _Inherit :: Traversal' StdStream StdStream -- | A Traversal' into the UseHandle structure's Handle for a -- StdStream _UseHandle :: Traversal' StdStream Handle -- | A Traversal' into the CreatePipe structure of a -- StdStream _CreatePipe :: Traversal' StdStream StdStream -- | A Traversal' into the NoStream structure of a -- StdStream _NoStream :: Traversal' StdStream StdStream -- | Class constraint proving a type has a prism into a Handle via a -- UseHandle structure. Any StdStream will have a prism -- into CreatePipe - it is just an overwrite to CreatePipe class IsCreatePipe a _CreatesPipe :: IsCreatePipe a => Traversal' a StdStream -- | Class constraint proving a type has a prism into an Inherit -- structure. Any StdStream will have a prism into Inherit -- - it is just an overwrite to Inherit class IsInherit a _Inherits :: IsInherit a => Traversal' a StdStream -- | Class constraint proving a type has a prism into a Handle via a -- UseHandle structure. class IsUseHandle a _UsesHandle :: IsUseHandle a => Traversal' a Handle -- | Class constraint proving a type has a prism into a Handle via a -- UseHandle structure. Any StdStream will have a prism -- into NoStream - it is just an overwrite to NoStream. class IsNoStream a _NoStreams :: IsNoStream a => Traversal' a StdStream -- | Given a lens into a StdStream, overwrite to Inherit so -- that the stream inherits from its parent process -- -- Examples: -- --
-- >>> inheriting ($) CreatePipe -- Inherit --inheriting :: Lens' a StdStream -> a -> a -- | Given a lens into a StdStream, overwrite to CreatePipe. -- -- Examples: -- --
-- >>> piping ($) NoStream -- CreatePipe --piping :: Lens' a StdStream -> a -> a -- | Given a lens into a StdStream and a handle, set the handle -- using UseHandle. Note that this is the only really interesting -- case for anything with a lens into a handle inculding -- StdStream. -- -- Examples: -- --
-- >>> handling ($) System.stdin $ UseHandle System.stdout
-- UseHandle {handle: <stdin>}
--
--
--
-- >>> handling ($) System.stdout Inherit
-- UseHandle {handle: <stdout>}
--
handling :: Lens' a StdStream -> Handle -> a -> a
-- | Given a lens into a StdStream, set to NoStream
--
-- Examples:
--
-- -- >>> nostreaming ($) Inherit -- NoStream --nostreaming :: Lens' a StdStream -> a -> a instance System.Process.Microlens.StdStream.IsNoStream System.Process.Common.StdStream instance System.Process.Microlens.StdStream.IsCreatePipe System.Process.Common.StdStream instance System.Process.Microlens.StdStream.IsUseHandle System.Process.Common.StdStream instance System.Process.Microlens.StdStream.IsInherit System.Process.Common.StdStream -- | Just the (classy) optics module System.Process.Microlens.Optics -- | A Traversal' into the ShellCommand case of a -- CmdSpec -- -- Examples: -- --
-- >>> ShellCommand "ls -l" ^? _ShellCommand -- Just "ls -l" ---- --
-- >>> RawCommand "/bin/ls" ["-l"] ^? _ShellCommand -- Nothing --_ShellCommand :: Traversal' CmdSpec String -- | A Traversal' into the RawCommand case of a -- CmdSpec -- -- Examples: -- --
-- >>> RawCommand "/bin/ls" ["-l"] ^? _RawCommand
-- Just ("/bin/ls",["-l"])
--
--
-- -- >>> RawCommand "/bin/ls" ["-l"] ^? _ShellCommand -- Nothing ---- --
-- >>> RawCommand "/bin/ls" ["-l"] ^. _RawCommand . _1 -- "/bin/ls" ---- --
-- >>> RawCommand "/bin/ls" ["-l"] ^. _RawCommand . _2 -- ["-l"] --_RawCommand :: Traversal' CmdSpec (FilePath, [String]) -- | A Traversal' into the Inherit structure of a -- StdStream _Inherit :: Traversal' StdStream StdStream -- | A Traversal' into the UseHandle structure's Handle for a -- StdStream _UseHandle :: Traversal' StdStream Handle -- | A Traversal' into the CreatePipe structure of a -- StdStream _CreatePipe :: Traversal' StdStream StdStream -- | A Traversal' into the NoStream structure of a -- StdStream _NoStream :: Traversal' StdStream StdStream -- | Traversal' into the arguments of a command -- -- Examples: -- --
-- >>> RawCommand "/bin/ls" ["-l"] ^. arguments -- ["-l"] --arguments :: Traversal' CmdSpec [String] -- | An isomorphism between a ProcessHandler and its tuple -- representation _Handler :: Lens' ProcessHandler (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle) -- | Lens into the cmdspec entry of the CreateProcess record cmdspec_ :: Lens' CreateProcess CmdSpec -- | Lens into the cwd entry of the CreateProcess record cwd_ :: Lens' CreateProcess (Maybe FilePath) -- | Lens into the env entry of the CreateProcess record env_ :: Lens' CreateProcess (Maybe [(String, String)]) -- | Lens into the std_in entry of the CreateProcess record stdin_ :: Lens' CreateProcess StdStream -- | Lens into the std_out entry of the CreateProcess record stdout_ :: Lens' CreateProcess StdStream -- | Lens into the std_err entry of the CreateProcess record stderr_ :: Lens' CreateProcess StdStream -- | Lens into the close_fds entry of the CreateProcess -- record closefds :: Lens' CreateProcess Bool -- | Lens into the create_group entry of the CreateProcess -- record creategroup :: Lens' CreateProcess Bool -- | Lens into the delegate_ctlc entry of the CreateProcess -- record delegatectlc :: Lens' CreateProcess Bool -- | Lens into the new_session entry of the CreateProcess -- record newsession :: Lens' CreateProcess Bool -- | Lens into the detach_console entry of the CreateProcess -- record detachconsole :: Lens' CreateProcess Bool -- | Lens into the create_new_console entry of the -- CreateProcess record createnewconsole :: Lens' CreateProcess Bool -- | Lens into the child_group entry of the CreateProcess -- record childgroup :: Lens' CreateProcess (Maybe CGid) -- | Lens into the child_user entry of the CreateProcess -- record childuser :: Lens' CreateProcess (Maybe CUid) -- | Lens into the use_process_jobs entry of the -- CreateProcess record useprocessjobs :: Lens' CreateProcess Bool -- | A lens into the stdin handle if requested hstdin :: Lens' ProcessHandler (Maybe Handle) -- | A lens into the stdout handle if requested hstdout :: Lens' ProcessHandler (Maybe Handle) -- | A lens into the stderr handle if requested hstderr :: Lens' ProcessHandler (Maybe Handle) -- | A lens into the process handle hhandle :: Lens' ProcessHandler ProcessHandle -- | Classy Traversal' into the raw command of a CmdSpec class IsRaw a _Raw :: IsRaw a => Traversal' a (FilePath, [String]) -- | Classy Traversal' into the shell command of a CmdSpec class IsShell a _Shell :: IsShell a => Traversal' a String -- | Class constraint proving a type has a prism into an Inherit -- structure. Any StdStream will have a prism into Inherit -- - it is just an overwrite to Inherit class IsInherit a _Inherits :: IsInherit a => Traversal' a StdStream -- | Class constraint proving a type has a prism into a Handle via a -- UseHandle structure. class IsUseHandle a _UsesHandle :: IsUseHandle a => Traversal' a Handle -- | Class constraint proving a type has a prism into a Handle via a -- UseHandle structure. Any StdStream will have a prism -- into CreatePipe - it is just an overwrite to CreatePipe class IsCreatePipe a _CreatesPipe :: IsCreatePipe a => Traversal' a StdStream -- | Class constraint proving a type has a prism into a Handle via a -- UseHandle structure. Any StdStream will have a prism -- into NoStream - it is just an overwrite to NoStream. class IsNoStream a _NoStreams :: IsNoStream a => Traversal' a StdStream -- | Classy lens for types with a stdin class HasStdin a _Stdin :: HasStdin a => Lens' a StdStream -- | Classy lens for types with a stdout class HasStdout a _Stdout :: HasStdout a => Lens' a StdStream -- | Classy lens for types with a stderr class HasStderr a _Stderr :: HasStderr a => Lens' a StdStream -- | This module provides all of the optical exports, as well ask any -- associated combinators. For just the optics, see Optics, or if -- you are in need of something lighter weight, just for working with a -- CreateProcess in terms of getters and setters, see -- https://hackage.haskell.org/package/microlens -- -- For more information on usage and how to work with lenses, see -- http://github.com/ekmett/lens/wiki and the tests for example -- uses. You can also ask questions on Freenode in the #haskell-lens -- channel. module System.Process.Microlens