{-# OPTIONS_GHC -Wall #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE LambdaCase #-}

module Control.Process.StdStream(
  StdStream(..)
, AsStdStream(..)
, HasStdStream(..)
) where

import Control.Category ( Category(id, (.)) )
import Control.Lens ( prism', Lens', Prism' )
import Data.Maybe ( Maybe(Nothing, Just) )
import System.Process ( StdStream(..) )

class AsStdStream a where
  _StdStream ::
    Prism' a StdStream
  _Inherit ::
    Prism' a ()
  _Inherit =
    forall a. AsStdStream a => Prism' a StdStream
_StdStream forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. forall a. AsStdStream a => Prism' a ()
_Inherit
  _CreatePipe ::
    Prism' a ()
  _CreatePipe =
    forall a. AsStdStream a => Prism' a StdStream
_StdStream forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. forall a. AsStdStream a => Prism' a ()
_CreatePipe
  _NoStream ::
    Prism' a ()
  _NoStream =
    forall a. AsStdStream a => Prism' a StdStream
_StdStream forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. forall a. AsStdStream a => Prism' a ()
_NoStream

instance AsStdStream StdStream where
  _StdStream :: Prism' StdStream StdStream
_StdStream =
    forall {k} (cat :: k -> k -> *) (a :: k). Category cat => cat a a
id
  _Inherit :: Prism' StdStream ()
_Inherit =
    forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism'
      (\() -> StdStream
Inherit)
      (\case
        StdStream
Inherit -> forall a. a -> Maybe a
Just ()
        StdStream
_ -> forall a. Maybe a
Nothing
      )
  _CreatePipe :: Prism' StdStream ()
_CreatePipe =
    forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism'
      (\() -> StdStream
CreatePipe)
      (\case
        StdStream
CreatePipe -> forall a. a -> Maybe a
Just ()
        StdStream
_ -> forall a. Maybe a
Nothing
      )
  _NoStream :: Prism' StdStream ()
_NoStream =
    forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b
prism'
      (\() -> StdStream
NoStream)
      (\case
        StdStream
NoStream -> forall a. a -> Maybe a
Just ()
        StdStream
_ -> forall a. Maybe a
Nothing
      )

class HasStdStream a where
  stdStream ::
    Lens' a StdStream

instance HasStdStream StdStream where
  stdStream :: Lens' StdStream StdStream
stdStream =
    forall {k} (cat :: k -> k -> *) (a :: k). Category cat => cat a a
id