microlens-process-0.1.0.1: Micro-optics for the process library

Copyright2019 Emily Pillmore
LicenseBSD
MaintainerEmily Pillmore <emilypi@cohomolo.gy>
StabilityExperimental
PortabilityTypeFamilies
Safe HaskellSafe
LanguageHaskell2010

System.Process.Microlens.CommandSpec

Contents

Description

This module provides the associated optics and combinators for working with CommandSpec objects. CommandSpec 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.

CommandSpec has two cases, and therefore a prism into those two cases. There is also a convenient Traversal available for working with the arglist of a Raw command, as well as associated Reviews for each prism, and combinators for working with arguments monoidally.

We provide classy variants for all useful prisms

Synopsis

Traversals

arguments :: Traversal' CmdSpec [String] Source #

Traversal' into the arguments of a command

Examples:

>>> RawCommand "/bin/ls" ["-l"] ^. arguments
["-l"]

Combinators

arguing :: String -> CmdSpec -> CmdSpec Source #

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"]