lens-process-0.3.0.1: Optics for system processes
Copyright2019 Emily Pillmore
LicenseBSD
MaintainerEmily Pillmore <emilypi@cohomolo.gy>
StabilityExperimental
PortabilityTypeFamilies, Rank2Types
Safe HaskellNone
LanguageHaskell2010

System.Process.Lens.StdStream

Description

This module provides the associated optics and combinators for working with StdStream objects. StdStream consists of four cases, for which we provide prisms and classy variants.

Synopsis

Prisms

_Inherit :: Prism' StdStream StdStream Source #

A Prism' into the Inherit structure of a StdStream

Examples:

>>> _Inherit # CreatePipe
Inherit

_UseHandle :: Prism' StdStream Handle Source #

A Prism' into the UseHandle structure's Handle for a StdStream

Examples:

>>> _UseHandle # System.stdin
UseHandle {handle: <stdin>}

_CreatePipe :: Prism' StdStream StdStream Source #

A Prism' into the CreatePipe structure of a StdStream

Examples:

>>> _CreatePipe # Inherit
CreatePipe

_NoStream :: Prism' StdStream StdStream Source #

A prism into the NoStream structure of a StdStream

Examples:

>>> _NoStream # CreatePipe
NoStream

Classy Prisms

class IsInherit a where Source #

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

Methods

_Inherits :: Prism' a StdStream Source #

Instances

Instances details
IsInherit StdStream Source # 
Instance details

Defined in System.Process.Lens.StdStream

class IsUseHandle a where Source #

Class constraint proving a type has a prism into a Handle via a UseHandle structure.

Methods

_UsesHandle :: Prism' a Handle Source #

Instances

Instances details
IsUseHandle StdStream Source # 
Instance details

Defined in System.Process.Lens.StdStream

class IsCreatePipe a where Source #

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

Methods

_CreatesPipe :: Prism' a StdStream Source #

Instances

Instances details
IsCreatePipe StdStream Source # 
Instance details

Defined in System.Process.Lens.StdStream

class IsNoStream a where Source #

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.

Methods

_NoStreams :: Prism' a StdStream Source #

Instances

Instances details
IsNoStream StdStream Source # 
Instance details

Defined in System.Process.Lens.StdStream

Combinators

usehandleOf :: IsUseHandle a => Handle -> a Source #

Inject a handle into something with a prism into the handle

Examples:

>>> usehandleOf @StdStream System.stdin
UseHandle {handle: <stdin>}

inheriting :: Lens' a StdStream -> a -> a Source #

Given a lens into a StdStream, overwrite to Inherit so that the stream inherits from its parent process

Examples:

>>> inheriting ($) CreatePipe
Inherit

piping :: Lens' a StdStream -> a -> a Source #

Given a lens into a StdStream, overwrite to CreatePipe.

Examples:

>>> piping ($) NoStream
CreatePipe

handling :: Lens' a StdStream -> Handle -> a -> a Source #

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.stdin NoStream
NoStream
>>> handling ($) System.stdin Inherit
Inherit

nostreaming :: Lens' a StdStream -> a -> a Source #

Given a lens into a StdStream, set to NoStream

Examples:

>>> nostreaming ($) Inherit
NoStream