module Chiasma.TmuxNative where

import Polysemy.Internal.Sing (KnownList)

import Chiasma.Data.CodecError (CodecError)
import Chiasma.Data.Panes (Panes, TmuxPanes)
import Chiasma.Data.TmuxRequest (TmuxRequest)
import Chiasma.Data.TmuxResponse (TmuxResponse)
import Chiasma.Effect.Codec (NativeCodecE)
import Chiasma.Effect.TmuxApi (TmuxApi)
import Chiasma.Effect.TmuxClient (NativeTmux, TmuxClient)
import Chiasma.Interpreter.TmuxApi (InterpretApisNative, RestopApisNative, TmuxApis, type (<$>))
import Chiasma.Tmux (withTmux, withTmuxApis, withTmuxApis', withTmuxApis_, withTmux_)

withTmuxApisNative' ::
   commands r a .
  InterpretApisNative commands r =>
  Member NativeTmux r =>
  Sem (TmuxApis commands CodecError ++ TmuxClient TmuxRequest TmuxResponse : r) a ->
  Sem r a
withTmuxApisNative' :: forall (commands :: [* -> *]) (r :: [(* -> *) -> * -> *]) a.
(InterpretApisNative commands r, Member NativeTmux r) =>
Sem
  (TmuxApis commands CodecError
   ++ (TmuxClient TmuxRequest TmuxResponse : r))
  a
-> Sem r a
withTmuxApisNative' =
  forall (commands :: [* -> *]) err i o (r :: [(* -> *) -> * -> *])
       a.
(InterpretApis commands err i o r, Member (ScopedTmux i o) r) =>
Sem (TmuxApis commands err ++ (TmuxClient i o : r)) a -> Sem r a
withTmuxApis' @commands @CodecError

withTmuxApisNative ::
   commands r .
  KnownList (TmuxApis commands CodecError) =>
  InterpretApisNative commands r =>
  Member NativeTmux r =>
  InterpretersFor (TmuxApis commands CodecError) r
withTmuxApisNative :: forall (commands :: [* -> *]) (r :: [(* -> *) -> * -> *]).
(KnownList (TmuxApis commands CodecError),
 InterpretApisNative commands r, Member NativeTmux r) =>
InterpretersFor (TmuxApis commands CodecError) r
withTmuxApisNative =
  forall (commands :: [* -> *]) err i o (r :: [(* -> *) -> * -> *]).
(KnownList (TmuxApis commands err),
 InterpretApis commands err i o r, Member (ScopedTmux i o) r) =>
InterpretersFor (TmuxApis commands err) r
withTmuxApis @commands @CodecError

withTmuxApisNative_ ::
   commands r .
  KnownList (TmuxApi <$> commands) =>
  RestopApisNative commands r =>
  Member NativeTmux r =>
  InterpretersFor (TmuxApi <$> commands) r
withTmuxApisNative_ :: forall (commands :: [* -> *]) (r :: [(* -> *) -> * -> *]).
(KnownList (TmuxApi <$> commands), RestopApisNative commands r,
 Member NativeTmux r) =>
InterpretersFor (TmuxApi <$> commands) r
withTmuxApisNative_ =
  forall (commands :: [* -> *]) err i o
       (apis :: [(* -> *) -> * -> *]) (r :: [(* -> *) -> * -> *]).
(apis ~ (TmuxApi <$> commands), KnownList apis,
 RestopApis commands err i o r, Member (ScopedTmux i o) r) =>
InterpretersFor apis r
forall {k} (commands :: [* -> *]) (err :: k) i o
       (apis :: [(* -> *) -> * -> *]) (r :: [(* -> *) -> * -> *]).
(apis ~ (TmuxApi <$> commands), KnownList apis,
 RestopApis commands err i o r, Member (ScopedTmux i o) r) =>
InterpretersFor apis r
withTmuxApis_ @commands @CodecError

withTmuxNative ::
   command r .
  Members [NativeTmux, NativeCodecE command] r =>
  InterpreterFor (TmuxApi command !! CodecError) r
withTmuxNative :: forall (command :: * -> *) (r :: [(* -> *) -> * -> *]).
Members '[NativeTmux, NativeCodecE command] r =>
InterpreterFor (TmuxApi command !! CodecError) r
withTmuxNative =
  Sem ((TmuxApi command !! CodecError) : r) a -> Sem r a
InterpreterFor (TmuxApi command !! CodecError) r
forall (command :: * -> *) err i o (r :: [(* -> *) -> * -> *]).
Members '[ScopedTmux i o, Codec command i o !! err] r =>
InterpreterFor (TmuxApi command !! err) r
withTmux

withTmuxNative_ ::
   command r .
  Members [NativeTmux, NativeCodecE command, Stop CodecError] r =>
  InterpreterFor (TmuxApi command) r
withTmuxNative_ :: forall (command :: * -> *) (r :: [(* -> *) -> * -> *]).
Members '[NativeTmux, NativeCodecE command, Stop CodecError] r =>
InterpreterFor (TmuxApi command) r
withTmuxNative_ =
  Sem (TmuxApi command : r) a -> Sem r a
InterpreterFor (TmuxApi command) r
forall (command :: * -> *) err i o (r :: [(* -> *) -> * -> *]).
Members '[ScopedTmux i o, Codec command i o !! err, Stop err] r =>
InterpreterFor (TmuxApi command) r
withTmux_

withPanesNative ::
   p r .
  Members [NativeTmux, NativeCodecE (Panes p)] r =>
  InterpreterFor (TmuxPanes p !! CodecError) r
withPanesNative :: forall p (r :: [(* -> *) -> * -> *]).
Members '[NativeTmux, NativeCodecE (Panes p)] r =>
InterpreterFor (TmuxPanes p !! CodecError) r
withPanesNative =
  Sem ((TmuxApi (Panes p) !! CodecError) : r) a -> Sem r a
InterpreterFor (TmuxApi (Panes p) !! CodecError) r
forall (command :: * -> *) (r :: [(* -> *) -> * -> *]).
Members '[NativeTmux, NativeCodecE command] r =>
InterpreterFor (TmuxApi command !! CodecError) r
withTmuxNative

withPanesNative_ ::
   p r .
  Members [NativeTmux, NativeCodecE (Panes p), Stop CodecError] r =>
  InterpreterFor (TmuxPanes p) r
withPanesNative_ :: forall p (r :: [(* -> *) -> * -> *]).
Members '[NativeTmux, NativeCodecE (Panes p), Stop CodecError] r =>
InterpreterFor (TmuxPanes p) r
withPanesNative_ =
  Sem (TmuxApi (Panes p) : r) a -> Sem r a
InterpreterFor (TmuxApi (Panes p)) r
forall (command :: * -> *) (r :: [(* -> *) -> * -> *]).
Members '[NativeTmux, NativeCodecE command, Stop CodecError] r =>
InterpreterFor (TmuxApi command) r
withTmuxNative_