{-# OPTIONS_HADDOCK not-home #-}
module Control.Effect.Internal.State where

import Data.Coerce

import Control.Effect
import Control.Effect.Carrier

import qualified Control.Monad.Trans.State.Strict as SSt
import qualified Control.Monad.Trans.State.Lazy as LSt

-- | An effect for __non-atomic__ stateful operations.
--
-- If you need atomicity, use 'Control.Effect.AtomicState.AtomicState'
-- instead.
data State s :: Effect where
  Get :: State s m s
  Put :: s -> State s m ()

newtype StateC s m a = StateC { StateC s m a -> StateT s m a
unStateC :: SSt.StateT s m a }
  deriving ( a -> StateC s m b -> StateC s m a
(a -> b) -> StateC s m a -> StateC s m b
(forall a b. (a -> b) -> StateC s m a -> StateC s m b)
-> (forall a b. a -> StateC s m b -> StateC s m a)
-> Functor (StateC s m)
forall a b. a -> StateC s m b -> StateC s m a
forall a b. (a -> b) -> StateC s m a -> StateC s m b
forall s (m :: * -> *) a b.
Functor m =>
a -> StateC s m b -> StateC s m a
forall s (m :: * -> *) a b.
Functor m =>
(a -> b) -> StateC s m a -> StateC s m b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> StateC s m b -> StateC s m a
$c<$ :: forall s (m :: * -> *) a b.
Functor m =>
a -> StateC s m b -> StateC s m a
fmap :: (a -> b) -> StateC s m a -> StateC s m b
$cfmap :: forall s (m :: * -> *) a b.
Functor m =>
(a -> b) -> StateC s m a -> StateC s m b
Functor, Functor (StateC s m)
a -> StateC s m a
Functor (StateC s m)
-> (forall a. a -> StateC s m a)
-> (forall a b.
    StateC s m (a -> b) -> StateC s m a -> StateC s m b)
-> (forall a b c.
    (a -> b -> c) -> StateC s m a -> StateC s m b -> StateC s m c)
-> (forall a b. StateC s m a -> StateC s m b -> StateC s m b)
-> (forall a b. StateC s m a -> StateC s m b -> StateC s m a)
-> Applicative (StateC s m)
StateC s m a -> StateC s m b -> StateC s m b
StateC s m a -> StateC s m b -> StateC s m a
StateC s m (a -> b) -> StateC s m a -> StateC s m b
(a -> b -> c) -> StateC s m a -> StateC s m b -> StateC s m c
forall a. a -> StateC s m a
forall a b. StateC s m a -> StateC s m b -> StateC s m a
forall a b. StateC s m a -> StateC s m b -> StateC s m b
forall a b. StateC s m (a -> b) -> StateC s m a -> StateC s m b
forall a b c.
(a -> b -> c) -> StateC s m a -> StateC s m b -> StateC s m c
forall s (m :: * -> *). Monad m => Functor (StateC s m)
forall s (m :: * -> *) a. Monad m => a -> StateC s m a
forall s (m :: * -> *) a b.
Monad m =>
StateC s m a -> StateC s m b -> StateC s m a
forall s (m :: * -> *) a b.
Monad m =>
StateC s m a -> StateC s m b -> StateC s m b
forall s (m :: * -> *) a b.
Monad m =>
StateC s m (a -> b) -> StateC s m a -> StateC s m b
forall s (m :: * -> *) a b c.
Monad m =>
(a -> b -> c) -> StateC s m a -> StateC s m b -> StateC s m c
forall (f :: * -> *).
Functor f
-> (forall a. a -> f a)
-> (forall a b. f (a -> b) -> f a -> f b)
-> (forall a b c. (a -> b -> c) -> f a -> f b -> f c)
-> (forall a b. f a -> f b -> f b)
-> (forall a b. f a -> f b -> f a)
-> Applicative f
<* :: StateC s m a -> StateC s m b -> StateC s m a
$c<* :: forall s (m :: * -> *) a b.
Monad m =>
StateC s m a -> StateC s m b -> StateC s m a
*> :: StateC s m a -> StateC s m b -> StateC s m b
$c*> :: forall s (m :: * -> *) a b.
Monad m =>
StateC s m a -> StateC s m b -> StateC s m b
liftA2 :: (a -> b -> c) -> StateC s m a -> StateC s m b -> StateC s m c
$cliftA2 :: forall s (m :: * -> *) a b c.
Monad m =>
(a -> b -> c) -> StateC s m a -> StateC s m b -> StateC s m c
<*> :: StateC s m (a -> b) -> StateC s m a -> StateC s m b
$c<*> :: forall s (m :: * -> *) a b.
Monad m =>
StateC s m (a -> b) -> StateC s m a -> StateC s m b
pure :: a -> StateC s m a
$cpure :: forall s (m :: * -> *) a. Monad m => a -> StateC s m a
$cp1Applicative :: forall s (m :: * -> *). Monad m => Functor (StateC s m)
Applicative, Applicative (StateC s m)
a -> StateC s m a
Applicative (StateC s m)
-> (forall a b.
    StateC s m a -> (a -> StateC s m b) -> StateC s m b)
-> (forall a b. StateC s m a -> StateC s m b -> StateC s m b)
-> (forall a. a -> StateC s m a)
-> Monad (StateC s m)
StateC s m a -> (a -> StateC s m b) -> StateC s m b
StateC s m a -> StateC s m b -> StateC s m b
forall a. a -> StateC s m a
forall a b. StateC s m a -> StateC s m b -> StateC s m b
forall a b. StateC s m a -> (a -> StateC s m b) -> StateC s m b
forall s (m :: * -> *). Monad m => Applicative (StateC s m)
forall s (m :: * -> *) a. Monad m => a -> StateC s m a
forall s (m :: * -> *) a b.
Monad m =>
StateC s m a -> StateC s m b -> StateC s m b
forall s (m :: * -> *) a b.
Monad m =>
StateC s m a -> (a -> StateC s m b) -> StateC s m b
forall (m :: * -> *).
Applicative m
-> (forall a b. m a -> (a -> m b) -> m b)
-> (forall a b. m a -> m b -> m b)
-> (forall a. a -> m a)
-> Monad m
return :: a -> StateC s m a
$creturn :: forall s (m :: * -> *) a. Monad m => a -> StateC s m a
>> :: StateC s m a -> StateC s m b -> StateC s m b
$c>> :: forall s (m :: * -> *) a b.
Monad m =>
StateC s m a -> StateC s m b -> StateC s m b
>>= :: StateC s m a -> (a -> StateC s m b) -> StateC s m b
$c>>= :: forall s (m :: * -> *) a b.
Monad m =>
StateC s m a -> (a -> StateC s m b) -> StateC s m b
$cp1Monad :: forall s (m :: * -> *). Monad m => Applicative (StateC s m)
Monad
           , Monad (StateC s m)
Monad (StateC s m)
-> (forall a. (a -> StateC s m a) -> StateC s m a)
-> MonadFix (StateC s m)
(a -> StateC s m a) -> StateC s m a
forall a. (a -> StateC s m a) -> StateC s m a
forall s (m :: * -> *). MonadFix m => Monad (StateC s m)
forall s (m :: * -> *) a.
MonadFix m =>
(a -> StateC s m a) -> StateC s m a
forall (m :: * -> *).
Monad m -> (forall a. (a -> m a) -> m a) -> MonadFix m
mfix :: (a -> StateC s m a) -> StateC s m a
$cmfix :: forall s (m :: * -> *) a.
MonadFix m =>
(a -> StateC s m a) -> StateC s m a
$cp1MonadFix :: forall s (m :: * -> *). MonadFix m => Monad (StateC s m)
MonadFix, Applicative (StateC s m)
StateC s m a
Applicative (StateC s m)
-> (forall a. StateC s m a)
-> (forall a. StateC s m a -> StateC s m a -> StateC s m a)
-> (forall a. StateC s m a -> StateC s m [a])
-> (forall a. StateC s m a -> StateC s m [a])
-> Alternative (StateC s m)
StateC s m a -> StateC s m a -> StateC s m a
StateC s m a -> StateC s m [a]
StateC s m a -> StateC s m [a]
forall a. StateC s m a
forall a. StateC s m a -> StateC s m [a]
forall a. StateC s m a -> StateC s m a -> StateC s m a
forall s (m :: * -> *). MonadPlus m => Applicative (StateC s m)
forall s (m :: * -> *) a. MonadPlus m => StateC s m a
forall s (m :: * -> *) a.
MonadPlus m =>
StateC s m a -> StateC s m [a]
forall s (m :: * -> *) a.
MonadPlus m =>
StateC s m a -> StateC s m a -> StateC s m a
forall (f :: * -> *).
Applicative f
-> (forall a. f a)
-> (forall a. f a -> f a -> f a)
-> (forall a. f a -> f [a])
-> (forall a. f a -> f [a])
-> Alternative f
many :: StateC s m a -> StateC s m [a]
$cmany :: forall s (m :: * -> *) a.
MonadPlus m =>
StateC s m a -> StateC s m [a]
some :: StateC s m a -> StateC s m [a]
$csome :: forall s (m :: * -> *) a.
MonadPlus m =>
StateC s m a -> StateC s m [a]
<|> :: StateC s m a -> StateC s m a -> StateC s m a
$c<|> :: forall s (m :: * -> *) a.
MonadPlus m =>
StateC s m a -> StateC s m a -> StateC s m a
empty :: StateC s m a
$cempty :: forall s (m :: * -> *) a. MonadPlus m => StateC s m a
$cp1Alternative :: forall s (m :: * -> *). MonadPlus m => Applicative (StateC s m)
Alternative, Monad (StateC s m)
Alternative (StateC s m)
StateC s m a
Alternative (StateC s m)
-> Monad (StateC s m)
-> (forall a. StateC s m a)
-> (forall a. StateC s m a -> StateC s m a -> StateC s m a)
-> MonadPlus (StateC s m)
StateC s m a -> StateC s m a -> StateC s m a
forall a. StateC s m a
forall a. StateC s m a -> StateC s m a -> StateC s m a
forall s (m :: * -> *). MonadPlus m => Monad (StateC s m)
forall s (m :: * -> *). MonadPlus m => Alternative (StateC s m)
forall s (m :: * -> *) a. MonadPlus m => StateC s m a
forall s (m :: * -> *) a.
MonadPlus m =>
StateC s m a -> StateC s m a -> StateC s m a
forall (m :: * -> *).
Alternative m
-> Monad m
-> (forall a. m a)
-> (forall a. m a -> m a -> m a)
-> MonadPlus m
mplus :: StateC s m a -> StateC s m a -> StateC s m a
$cmplus :: forall s (m :: * -> *) a.
MonadPlus m =>
StateC s m a -> StateC s m a -> StateC s m a
mzero :: StateC s m a
$cmzero :: forall s (m :: * -> *) a. MonadPlus m => StateC s m a
$cp2MonadPlus :: forall s (m :: * -> *). MonadPlus m => Monad (StateC s m)
$cp1MonadPlus :: forall s (m :: * -> *). MonadPlus m => Alternative (StateC s m)
MonadPlus
           , Monad (StateC s m)
Monad (StateC s m)
-> (forall a. String -> StateC s m a) -> MonadFail (StateC s m)
String -> StateC s m a
forall a. String -> StateC s m a
forall s (m :: * -> *). MonadFail m => Monad (StateC s m)
forall s (m :: * -> *) a. MonadFail m => String -> StateC s m a
forall (m :: * -> *).
Monad m -> (forall a. String -> m a) -> MonadFail m
fail :: String -> StateC s m a
$cfail :: forall s (m :: * -> *) a. MonadFail m => String -> StateC s m a
$cp1MonadFail :: forall s (m :: * -> *). MonadFail m => Monad (StateC s m)
MonadFail, Monad (StateC s m)
Monad (StateC s m)
-> (forall a. IO a -> StateC s m a) -> MonadIO (StateC s m)
IO a -> StateC s m a
forall a. IO a -> StateC s m a
forall s (m :: * -> *). MonadIO m => Monad (StateC s m)
forall s (m :: * -> *) a. MonadIO m => IO a -> StateC s m a
forall (m :: * -> *).
Monad m -> (forall a. IO a -> m a) -> MonadIO m
liftIO :: IO a -> StateC s m a
$cliftIO :: forall s (m :: * -> *) a. MonadIO m => IO a -> StateC s m a
$cp1MonadIO :: forall s (m :: * -> *). MonadIO m => Monad (StateC s m)
MonadIO
           , Monad (StateC s m)
e -> StateC s m a
Monad (StateC s m)
-> (forall e a. Exception e => e -> StateC s m a)
-> MonadThrow (StateC s m)
forall e a. Exception e => e -> StateC s m a
forall s (m :: * -> *). MonadThrow m => Monad (StateC s m)
forall s (m :: * -> *) e a.
(MonadThrow m, Exception e) =>
e -> StateC s m a
forall (m :: * -> *).
Monad m -> (forall e a. Exception e => e -> m a) -> MonadThrow m
throwM :: e -> StateC s m a
$cthrowM :: forall s (m :: * -> *) e a.
(MonadThrow m, Exception e) =>
e -> StateC s m a
$cp1MonadThrow :: forall s (m :: * -> *). MonadThrow m => Monad (StateC s m)
MonadThrow, MonadThrow (StateC s m)
MonadThrow (StateC s m)
-> (forall e a.
    Exception e =>
    StateC s m a -> (e -> StateC s m a) -> StateC s m a)
-> MonadCatch (StateC s m)
StateC s m a -> (e -> StateC s m a) -> StateC s m a
forall e a.
Exception e =>
StateC s m a -> (e -> StateC s m a) -> StateC s m a
forall s (m :: * -> *). MonadCatch m => MonadThrow (StateC s m)
forall s (m :: * -> *) e a.
(MonadCatch m, Exception e) =>
StateC s m a -> (e -> StateC s m a) -> StateC s m a
forall (m :: * -> *).
MonadThrow m
-> (forall e a. Exception e => m a -> (e -> m a) -> m a)
-> MonadCatch m
catch :: StateC s m a -> (e -> StateC s m a) -> StateC s m a
$ccatch :: forall s (m :: * -> *) e a.
(MonadCatch m, Exception e) =>
StateC s m a -> (e -> StateC s m a) -> StateC s m a
$cp1MonadCatch :: forall s (m :: * -> *). MonadCatch m => MonadThrow (StateC s m)
MonadCatch, MonadCatch (StateC s m)
MonadCatch (StateC s m)
-> (forall b.
    ((forall a. StateC s m a -> StateC s m a) -> StateC s m b)
    -> StateC s m b)
-> (forall b.
    ((forall a. StateC s m a -> StateC s m a) -> StateC s m b)
    -> StateC s m b)
-> (forall a b c.
    StateC s m a
    -> (a -> ExitCase b -> StateC s m c)
    -> (a -> StateC s m b)
    -> StateC s m (b, c))
-> MonadMask (StateC s m)
StateC s m a
-> (a -> ExitCase b -> StateC s m c)
-> (a -> StateC s m b)
-> StateC s m (b, c)
((forall a. StateC s m a -> StateC s m a) -> StateC s m b)
-> StateC s m b
((forall a. StateC s m a -> StateC s m a) -> StateC s m b)
-> StateC s m b
forall b.
((forall a. StateC s m a -> StateC s m a) -> StateC s m b)
-> StateC s m b
forall a b c.
StateC s m a
-> (a -> ExitCase b -> StateC s m c)
-> (a -> StateC s m b)
-> StateC s m (b, c)
forall s (m :: * -> *). MonadMask m => MonadCatch (StateC s m)
forall s (m :: * -> *) b.
MonadMask m =>
((forall a. StateC s m a -> StateC s m a) -> StateC s m b)
-> StateC s m b
forall s (m :: * -> *) a b c.
MonadMask m =>
StateC s m a
-> (a -> ExitCase b -> StateC s m c)
-> (a -> StateC s m b)
-> StateC s m (b, c)
forall (m :: * -> *).
MonadCatch m
-> (forall b. ((forall a. m a -> m a) -> m b) -> m b)
-> (forall b. ((forall a. m a -> m a) -> m b) -> m b)
-> (forall a b c.
    m a -> (a -> ExitCase b -> m c) -> (a -> m b) -> m (b, c))
-> MonadMask m
generalBracket :: StateC s m a
-> (a -> ExitCase b -> StateC s m c)
-> (a -> StateC s m b)
-> StateC s m (b, c)
$cgeneralBracket :: forall s (m :: * -> *) a b c.
MonadMask m =>
StateC s m a
-> (a -> ExitCase b -> StateC s m c)
-> (a -> StateC s m b)
-> StateC s m (b, c)
uninterruptibleMask :: ((forall a. StateC s m a -> StateC s m a) -> StateC s m b)
-> StateC s m b
$cuninterruptibleMask :: forall s (m :: * -> *) b.
MonadMask m =>
((forall a. StateC s m a -> StateC s m a) -> StateC s m b)
-> StateC s m b
mask :: ((forall a. StateC s m a -> StateC s m a) -> StateC s m b)
-> StateC s m b
$cmask :: forall s (m :: * -> *) b.
MonadMask m =>
((forall a. StateC s m a -> StateC s m a) -> StateC s m b)
-> StateC s m b
$cp1MonadMask :: forall s (m :: * -> *). MonadMask m => MonadCatch (StateC s m)
MonadMask
           , MonadBase b, MonadBaseControl b
           )
  deriving (m a -> StateC s m a
(forall (m :: * -> *) a. Monad m => m a -> StateC s m a)
-> MonadTrans (StateC s)
forall s (m :: * -> *) a. Monad m => m a -> StateC s m a
forall (m :: * -> *) a. Monad m => m a -> StateC s m a
forall (t :: (* -> *) -> * -> *).
(forall (m :: * -> *) a. Monad m => m a -> t m a) -> MonadTrans t
lift :: m a -> StateC s m a
$clift :: forall s (m :: * -> *) a. Monad m => m a -> StateC s m a
MonadTrans, MonadTrans (StateC s)
m (StT (StateC s) a) -> StateC s m a
MonadTrans (StateC s)
-> (forall (m :: * -> *) a.
    Monad m =>
    (Run (StateC s) -> m a) -> StateC s m a)
-> (forall (m :: * -> *) a.
    Monad m =>
    m (StT (StateC s) a) -> StateC s m a)
-> MonadTransControl (StateC s)
(Run (StateC s) -> m a) -> StateC s m a
forall s. MonadTrans (StateC s)
forall s (m :: * -> *) a.
Monad m =>
m (StT (StateC s) a) -> StateC s m a
forall s (m :: * -> *) a.
Monad m =>
(Run (StateC s) -> m a) -> StateC s m a
forall (m :: * -> *) a.
Monad m =>
m (StT (StateC s) a) -> StateC s m a
forall (m :: * -> *) a.
Monad m =>
(Run (StateC s) -> m a) -> StateC s m a
forall (t :: (* -> *) -> * -> *).
MonadTrans t
-> (forall (m :: * -> *) a. Monad m => (Run t -> m a) -> t m a)
-> (forall (m :: * -> *) a. Monad m => m (StT t a) -> t m a)
-> MonadTransControl t
restoreT :: m (StT (StateC s) a) -> StateC s m a
$crestoreT :: forall s (m :: * -> *) a.
Monad m =>
m (StT (StateC s) a) -> StateC s m a
liftWith :: (Run (StateC s) -> m a) -> StateC s m a
$cliftWith :: forall s (m :: * -> *) a.
Monad m =>
(Run (StateC s) -> m a) -> StateC s m a
$cp1MonadTransControl :: forall s. MonadTrans (StateC s)
MonadTransControl)

instance ( Carrier m
         , Threads (SSt.StateT s) (Prims m)
         )
      => Carrier (StateC s m) where
  type Derivs (StateC s m) = State s ': Derivs m
  type Prims  (StateC s m) = Prims m

  algPrims :: Algebra' (Prims (StateC s m)) (StateC s m) a
algPrims = (Union (Prims m) (StateT s m) a -> StateT s m a)
-> Algebra' (Prims m) (StateC s m) a
coerce (Algebra (Prims m) m -> Algebra (Prims m) (StateT s m)
forall (t :: (* -> *) -> * -> *) (p :: [(* -> *) -> * -> *])
       (m :: * -> *).
(Threads t p, Monad m) =>
Algebra p m -> Algebra p (t m)
thread @(SSt.StateT s) (Carrier m => Algebra (Prims m) m
forall (m :: * -> *) a. Carrier m => Algebra' (Prims m) m a
algPrims @m))
  {-# INLINEABLE algPrims #-}

  reformulate :: Reformulation'
  (Derivs (StateC s m)) (Prims (StateC s m)) (StateC s m) z a
reformulate forall x. StateC s m x -> z x
n Algebra (Prims (StateC s m)) z
alg = Algebra' (Derivs m) z a
-> (State s z a -> z a) -> Algebra' (State s : Derivs m) z a
forall (e :: (* -> *) -> * -> *) (r :: [(* -> *) -> * -> *])
       (m :: * -> *) a.
RepresentationalEff e =>
Algebra' r m a -> (e m a -> m a) -> Algebra' (e : r) m a
powerAlg (Reformulation' (Derivs m) (Prims m) m z a
forall (m :: * -> *) (z :: * -> *) a.
(Carrier m, Monad z) =>
Reformulation' (Derivs m) (Prims m) m z a
reformulate (StateC s m x -> z x
forall x. StateC s m x -> z x
n (StateC s m x -> z x) -> (m x -> StateC s m x) -> m x -> z x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. m x -> StateC s m x
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift) forall x. Union (Prims m) z x -> z x
Algebra (Prims (StateC s m)) z
alg) ((State s z a -> z a) -> Algebra' (State s : Derivs m) z a)
-> (State s z a -> z a) -> Algebra' (State s : Derivs m) z a
forall a b. (a -> b) -> a -> b
$ \case
    Put s
s -> StateC s m () -> z ()
forall x. StateC s m x -> z x
n (StateC s m () -> z ()) -> StateC s m () -> z ()
forall a b. (a -> b) -> a -> b
$ StateT s m () -> StateC s m ()
forall s (m :: * -> *) a. StateT s m a -> StateC s m a
StateC (StateT s m () -> StateC s m ()) -> StateT s m () -> StateC s m ()
forall a b. (a -> b) -> a -> b
$ s -> StateT s m ()
forall (m :: * -> *) s. Monad m => s -> StateT s m ()
SSt.put s
s
    State s z a
Get   -> StateC s m s -> z s
forall x. StateC s m x -> z x
n (StateT s m s -> StateC s m s
forall s (m :: * -> *) a. StateT s m a -> StateC s m a
StateC StateT s m s
forall (m :: * -> *) s. Monad m => StateT s m s
SSt.get)
  {-# INLINEABLE reformulate #-}

newtype StateLazyC s m a = StateLazyC { StateLazyC s m a -> StateT s m a
unStateLazyC :: LSt.StateT s m a }
  deriving ( a -> StateLazyC s m b -> StateLazyC s m a
(a -> b) -> StateLazyC s m a -> StateLazyC s m b
(forall a b. (a -> b) -> StateLazyC s m a -> StateLazyC s m b)
-> (forall a b. a -> StateLazyC s m b -> StateLazyC s m a)
-> Functor (StateLazyC s m)
forall a b. a -> StateLazyC s m b -> StateLazyC s m a
forall a b. (a -> b) -> StateLazyC s m a -> StateLazyC s m b
forall s (m :: * -> *) a b.
Functor m =>
a -> StateLazyC s m b -> StateLazyC s m a
forall s (m :: * -> *) a b.
Functor m =>
(a -> b) -> StateLazyC s m a -> StateLazyC s m b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> StateLazyC s m b -> StateLazyC s m a
$c<$ :: forall s (m :: * -> *) a b.
Functor m =>
a -> StateLazyC s m b -> StateLazyC s m a
fmap :: (a -> b) -> StateLazyC s m a -> StateLazyC s m b
$cfmap :: forall s (m :: * -> *) a b.
Functor m =>
(a -> b) -> StateLazyC s m a -> StateLazyC s m b
Functor, Functor (StateLazyC s m)
a -> StateLazyC s m a
Functor (StateLazyC s m)
-> (forall a. a -> StateLazyC s m a)
-> (forall a b.
    StateLazyC s m (a -> b) -> StateLazyC s m a -> StateLazyC s m b)
-> (forall a b c.
    (a -> b -> c)
    -> StateLazyC s m a -> StateLazyC s m b -> StateLazyC s m c)
-> (forall a b.
    StateLazyC s m a -> StateLazyC s m b -> StateLazyC s m b)
-> (forall a b.
    StateLazyC s m a -> StateLazyC s m b -> StateLazyC s m a)
-> Applicative (StateLazyC s m)
StateLazyC s m a -> StateLazyC s m b -> StateLazyC s m b
StateLazyC s m a -> StateLazyC s m b -> StateLazyC s m a
StateLazyC s m (a -> b) -> StateLazyC s m a -> StateLazyC s m b
(a -> b -> c)
-> StateLazyC s m a -> StateLazyC s m b -> StateLazyC s m c
forall a. a -> StateLazyC s m a
forall a b.
StateLazyC s m a -> StateLazyC s m b -> StateLazyC s m a
forall a b.
StateLazyC s m a -> StateLazyC s m b -> StateLazyC s m b
forall a b.
StateLazyC s m (a -> b) -> StateLazyC s m a -> StateLazyC s m b
forall a b c.
(a -> b -> c)
-> StateLazyC s m a -> StateLazyC s m b -> StateLazyC s m c
forall s (m :: * -> *). Monad m => Functor (StateLazyC s m)
forall s (m :: * -> *) a. Monad m => a -> StateLazyC s m a
forall s (m :: * -> *) a b.
Monad m =>
StateLazyC s m a -> StateLazyC s m b -> StateLazyC s m a
forall s (m :: * -> *) a b.
Monad m =>
StateLazyC s m a -> StateLazyC s m b -> StateLazyC s m b
forall s (m :: * -> *) a b.
Monad m =>
StateLazyC s m (a -> b) -> StateLazyC s m a -> StateLazyC s m b
forall s (m :: * -> *) a b c.
Monad m =>
(a -> b -> c)
-> StateLazyC s m a -> StateLazyC s m b -> StateLazyC s m c
forall (f :: * -> *).
Functor f
-> (forall a. a -> f a)
-> (forall a b. f (a -> b) -> f a -> f b)
-> (forall a b c. (a -> b -> c) -> f a -> f b -> f c)
-> (forall a b. f a -> f b -> f b)
-> (forall a b. f a -> f b -> f a)
-> Applicative f
<* :: StateLazyC s m a -> StateLazyC s m b -> StateLazyC s m a
$c<* :: forall s (m :: * -> *) a b.
Monad m =>
StateLazyC s m a -> StateLazyC s m b -> StateLazyC s m a
*> :: StateLazyC s m a -> StateLazyC s m b -> StateLazyC s m b
$c*> :: forall s (m :: * -> *) a b.
Monad m =>
StateLazyC s m a -> StateLazyC s m b -> StateLazyC s m b
liftA2 :: (a -> b -> c)
-> StateLazyC s m a -> StateLazyC s m b -> StateLazyC s m c
$cliftA2 :: forall s (m :: * -> *) a b c.
Monad m =>
(a -> b -> c)
-> StateLazyC s m a -> StateLazyC s m b -> StateLazyC s m c
<*> :: StateLazyC s m (a -> b) -> StateLazyC s m a -> StateLazyC s m b
$c<*> :: forall s (m :: * -> *) a b.
Monad m =>
StateLazyC s m (a -> b) -> StateLazyC s m a -> StateLazyC s m b
pure :: a -> StateLazyC s m a
$cpure :: forall s (m :: * -> *) a. Monad m => a -> StateLazyC s m a
$cp1Applicative :: forall s (m :: * -> *). Monad m => Functor (StateLazyC s m)
Applicative, Applicative (StateLazyC s m)
a -> StateLazyC s m a
Applicative (StateLazyC s m)
-> (forall a b.
    StateLazyC s m a -> (a -> StateLazyC s m b) -> StateLazyC s m b)
-> (forall a b.
    StateLazyC s m a -> StateLazyC s m b -> StateLazyC s m b)
-> (forall a. a -> StateLazyC s m a)
-> Monad (StateLazyC s m)
StateLazyC s m a -> (a -> StateLazyC s m b) -> StateLazyC s m b
StateLazyC s m a -> StateLazyC s m b -> StateLazyC s m b
forall a. a -> StateLazyC s m a
forall a b.
StateLazyC s m a -> StateLazyC s m b -> StateLazyC s m b
forall a b.
StateLazyC s m a -> (a -> StateLazyC s m b) -> StateLazyC s m b
forall s (m :: * -> *). Monad m => Applicative (StateLazyC s m)
forall s (m :: * -> *) a. Monad m => a -> StateLazyC s m a
forall s (m :: * -> *) a b.
Monad m =>
StateLazyC s m a -> StateLazyC s m b -> StateLazyC s m b
forall s (m :: * -> *) a b.
Monad m =>
StateLazyC s m a -> (a -> StateLazyC s m b) -> StateLazyC s m b
forall (m :: * -> *).
Applicative m
-> (forall a b. m a -> (a -> m b) -> m b)
-> (forall a b. m a -> m b -> m b)
-> (forall a. a -> m a)
-> Monad m
return :: a -> StateLazyC s m a
$creturn :: forall s (m :: * -> *) a. Monad m => a -> StateLazyC s m a
>> :: StateLazyC s m a -> StateLazyC s m b -> StateLazyC s m b
$c>> :: forall s (m :: * -> *) a b.
Monad m =>
StateLazyC s m a -> StateLazyC s m b -> StateLazyC s m b
>>= :: StateLazyC s m a -> (a -> StateLazyC s m b) -> StateLazyC s m b
$c>>= :: forall s (m :: * -> *) a b.
Monad m =>
StateLazyC s m a -> (a -> StateLazyC s m b) -> StateLazyC s m b
$cp1Monad :: forall s (m :: * -> *). Monad m => Applicative (StateLazyC s m)
Monad
           , Monad (StateLazyC s m)
Monad (StateLazyC s m)
-> (forall a. (a -> StateLazyC s m a) -> StateLazyC s m a)
-> MonadFix (StateLazyC s m)
(a -> StateLazyC s m a) -> StateLazyC s m a
forall a. (a -> StateLazyC s m a) -> StateLazyC s m a
forall s (m :: * -> *). MonadFix m => Monad (StateLazyC s m)
forall s (m :: * -> *) a.
MonadFix m =>
(a -> StateLazyC s m a) -> StateLazyC s m a
forall (m :: * -> *).
Monad m -> (forall a. (a -> m a) -> m a) -> MonadFix m
mfix :: (a -> StateLazyC s m a) -> StateLazyC s m a
$cmfix :: forall s (m :: * -> *) a.
MonadFix m =>
(a -> StateLazyC s m a) -> StateLazyC s m a
$cp1MonadFix :: forall s (m :: * -> *). MonadFix m => Monad (StateLazyC s m)
MonadFix, Applicative (StateLazyC s m)
StateLazyC s m a
Applicative (StateLazyC s m)
-> (forall a. StateLazyC s m a)
-> (forall a.
    StateLazyC s m a -> StateLazyC s m a -> StateLazyC s m a)
-> (forall a. StateLazyC s m a -> StateLazyC s m [a])
-> (forall a. StateLazyC s m a -> StateLazyC s m [a])
-> Alternative (StateLazyC s m)
StateLazyC s m a -> StateLazyC s m a -> StateLazyC s m a
StateLazyC s m a -> StateLazyC s m [a]
StateLazyC s m a -> StateLazyC s m [a]
forall a. StateLazyC s m a
forall a. StateLazyC s m a -> StateLazyC s m [a]
forall a. StateLazyC s m a -> StateLazyC s m a -> StateLazyC s m a
forall s (m :: * -> *). MonadPlus m => Applicative (StateLazyC s m)
forall s (m :: * -> *) a. MonadPlus m => StateLazyC s m a
forall s (m :: * -> *) a.
MonadPlus m =>
StateLazyC s m a -> StateLazyC s m [a]
forall s (m :: * -> *) a.
MonadPlus m =>
StateLazyC s m a -> StateLazyC s m a -> StateLazyC s m a
forall (f :: * -> *).
Applicative f
-> (forall a. f a)
-> (forall a. f a -> f a -> f a)
-> (forall a. f a -> f [a])
-> (forall a. f a -> f [a])
-> Alternative f
many :: StateLazyC s m a -> StateLazyC s m [a]
$cmany :: forall s (m :: * -> *) a.
MonadPlus m =>
StateLazyC s m a -> StateLazyC s m [a]
some :: StateLazyC s m a -> StateLazyC s m [a]
$csome :: forall s (m :: * -> *) a.
MonadPlus m =>
StateLazyC s m a -> StateLazyC s m [a]
<|> :: StateLazyC s m a -> StateLazyC s m a -> StateLazyC s m a
$c<|> :: forall s (m :: * -> *) a.
MonadPlus m =>
StateLazyC s m a -> StateLazyC s m a -> StateLazyC s m a
empty :: StateLazyC s m a
$cempty :: forall s (m :: * -> *) a. MonadPlus m => StateLazyC s m a
$cp1Alternative :: forall s (m :: * -> *). MonadPlus m => Applicative (StateLazyC s m)
Alternative, Monad (StateLazyC s m)
Alternative (StateLazyC s m)
StateLazyC s m a
Alternative (StateLazyC s m)
-> Monad (StateLazyC s m)
-> (forall a. StateLazyC s m a)
-> (forall a.
    StateLazyC s m a -> StateLazyC s m a -> StateLazyC s m a)
-> MonadPlus (StateLazyC s m)
StateLazyC s m a -> StateLazyC s m a -> StateLazyC s m a
forall a. StateLazyC s m a
forall a. StateLazyC s m a -> StateLazyC s m a -> StateLazyC s m a
forall s (m :: * -> *). MonadPlus m => Monad (StateLazyC s m)
forall s (m :: * -> *). MonadPlus m => Alternative (StateLazyC s m)
forall s (m :: * -> *) a. MonadPlus m => StateLazyC s m a
forall s (m :: * -> *) a.
MonadPlus m =>
StateLazyC s m a -> StateLazyC s m a -> StateLazyC s m a
forall (m :: * -> *).
Alternative m
-> Monad m
-> (forall a. m a)
-> (forall a. m a -> m a -> m a)
-> MonadPlus m
mplus :: StateLazyC s m a -> StateLazyC s m a -> StateLazyC s m a
$cmplus :: forall s (m :: * -> *) a.
MonadPlus m =>
StateLazyC s m a -> StateLazyC s m a -> StateLazyC s m a
mzero :: StateLazyC s m a
$cmzero :: forall s (m :: * -> *) a. MonadPlus m => StateLazyC s m a
$cp2MonadPlus :: forall s (m :: * -> *). MonadPlus m => Monad (StateLazyC s m)
$cp1MonadPlus :: forall s (m :: * -> *). MonadPlus m => Alternative (StateLazyC s m)
MonadPlus
           , Monad (StateLazyC s m)
Monad (StateLazyC s m)
-> (forall a. String -> StateLazyC s m a)
-> MonadFail (StateLazyC s m)
String -> StateLazyC s m a
forall a. String -> StateLazyC s m a
forall s (m :: * -> *). MonadFail m => Monad (StateLazyC s m)
forall s (m :: * -> *) a. MonadFail m => String -> StateLazyC s m a
forall (m :: * -> *).
Monad m -> (forall a. String -> m a) -> MonadFail m
fail :: String -> StateLazyC s m a
$cfail :: forall s (m :: * -> *) a. MonadFail m => String -> StateLazyC s m a
$cp1MonadFail :: forall s (m :: * -> *). MonadFail m => Monad (StateLazyC s m)
MonadFail, Monad (StateLazyC s m)
Monad (StateLazyC s m)
-> (forall a. IO a -> StateLazyC s m a) -> MonadIO (StateLazyC s m)
IO a -> StateLazyC s m a
forall a. IO a -> StateLazyC s m a
forall s (m :: * -> *). MonadIO m => Monad (StateLazyC s m)
forall s (m :: * -> *) a. MonadIO m => IO a -> StateLazyC s m a
forall (m :: * -> *).
Monad m -> (forall a. IO a -> m a) -> MonadIO m
liftIO :: IO a -> StateLazyC s m a
$cliftIO :: forall s (m :: * -> *) a. MonadIO m => IO a -> StateLazyC s m a
$cp1MonadIO :: forall s (m :: * -> *). MonadIO m => Monad (StateLazyC s m)
MonadIO
           , Monad (StateLazyC s m)
e -> StateLazyC s m a
Monad (StateLazyC s m)
-> (forall e a. Exception e => e -> StateLazyC s m a)
-> MonadThrow (StateLazyC s m)
forall e a. Exception e => e -> StateLazyC s m a
forall s (m :: * -> *). MonadThrow m => Monad (StateLazyC s m)
forall s (m :: * -> *) e a.
(MonadThrow m, Exception e) =>
e -> StateLazyC s m a
forall (m :: * -> *).
Monad m -> (forall e a. Exception e => e -> m a) -> MonadThrow m
throwM :: e -> StateLazyC s m a
$cthrowM :: forall s (m :: * -> *) e a.
(MonadThrow m, Exception e) =>
e -> StateLazyC s m a
$cp1MonadThrow :: forall s (m :: * -> *). MonadThrow m => Monad (StateLazyC s m)
MonadThrow, MonadThrow (StateLazyC s m)
MonadThrow (StateLazyC s m)
-> (forall e a.
    Exception e =>
    StateLazyC s m a -> (e -> StateLazyC s m a) -> StateLazyC s m a)
-> MonadCatch (StateLazyC s m)
StateLazyC s m a -> (e -> StateLazyC s m a) -> StateLazyC s m a
forall e a.
Exception e =>
StateLazyC s m a -> (e -> StateLazyC s m a) -> StateLazyC s m a
forall s (m :: * -> *). MonadCatch m => MonadThrow (StateLazyC s m)
forall s (m :: * -> *) e a.
(MonadCatch m, Exception e) =>
StateLazyC s m a -> (e -> StateLazyC s m a) -> StateLazyC s m a
forall (m :: * -> *).
MonadThrow m
-> (forall e a. Exception e => m a -> (e -> m a) -> m a)
-> MonadCatch m
catch :: StateLazyC s m a -> (e -> StateLazyC s m a) -> StateLazyC s m a
$ccatch :: forall s (m :: * -> *) e a.
(MonadCatch m, Exception e) =>
StateLazyC s m a -> (e -> StateLazyC s m a) -> StateLazyC s m a
$cp1MonadCatch :: forall s (m :: * -> *). MonadCatch m => MonadThrow (StateLazyC s m)
MonadCatch, MonadCatch (StateLazyC s m)
MonadCatch (StateLazyC s m)
-> (forall b.
    ((forall a. StateLazyC s m a -> StateLazyC s m a)
     -> StateLazyC s m b)
    -> StateLazyC s m b)
-> (forall b.
    ((forall a. StateLazyC s m a -> StateLazyC s m a)
     -> StateLazyC s m b)
    -> StateLazyC s m b)
-> (forall a b c.
    StateLazyC s m a
    -> (a -> ExitCase b -> StateLazyC s m c)
    -> (a -> StateLazyC s m b)
    -> StateLazyC s m (b, c))
-> MonadMask (StateLazyC s m)
StateLazyC s m a
-> (a -> ExitCase b -> StateLazyC s m c)
-> (a -> StateLazyC s m b)
-> StateLazyC s m (b, c)
((forall a. StateLazyC s m a -> StateLazyC s m a)
 -> StateLazyC s m b)
-> StateLazyC s m b
((forall a. StateLazyC s m a -> StateLazyC s m a)
 -> StateLazyC s m b)
-> StateLazyC s m b
forall b.
((forall a. StateLazyC s m a -> StateLazyC s m a)
 -> StateLazyC s m b)
-> StateLazyC s m b
forall a b c.
StateLazyC s m a
-> (a -> ExitCase b -> StateLazyC s m c)
-> (a -> StateLazyC s m b)
-> StateLazyC s m (b, c)
forall s (m :: * -> *). MonadMask m => MonadCatch (StateLazyC s m)
forall s (m :: * -> *) b.
MonadMask m =>
((forall a. StateLazyC s m a -> StateLazyC s m a)
 -> StateLazyC s m b)
-> StateLazyC s m b
forall s (m :: * -> *) a b c.
MonadMask m =>
StateLazyC s m a
-> (a -> ExitCase b -> StateLazyC s m c)
-> (a -> StateLazyC s m b)
-> StateLazyC s m (b, c)
forall (m :: * -> *).
MonadCatch m
-> (forall b. ((forall a. m a -> m a) -> m b) -> m b)
-> (forall b. ((forall a. m a -> m a) -> m b) -> m b)
-> (forall a b c.
    m a -> (a -> ExitCase b -> m c) -> (a -> m b) -> m (b, c))
-> MonadMask m
generalBracket :: StateLazyC s m a
-> (a -> ExitCase b -> StateLazyC s m c)
-> (a -> StateLazyC s m b)
-> StateLazyC s m (b, c)
$cgeneralBracket :: forall s (m :: * -> *) a b c.
MonadMask m =>
StateLazyC s m a
-> (a -> ExitCase b -> StateLazyC s m c)
-> (a -> StateLazyC s m b)
-> StateLazyC s m (b, c)
uninterruptibleMask :: ((forall a. StateLazyC s m a -> StateLazyC s m a)
 -> StateLazyC s m b)
-> StateLazyC s m b
$cuninterruptibleMask :: forall s (m :: * -> *) b.
MonadMask m =>
((forall a. StateLazyC s m a -> StateLazyC s m a)
 -> StateLazyC s m b)
-> StateLazyC s m b
mask :: ((forall a. StateLazyC s m a -> StateLazyC s m a)
 -> StateLazyC s m b)
-> StateLazyC s m b
$cmask :: forall s (m :: * -> *) b.
MonadMask m =>
((forall a. StateLazyC s m a -> StateLazyC s m a)
 -> StateLazyC s m b)
-> StateLazyC s m b
$cp1MonadMask :: forall s (m :: * -> *). MonadMask m => MonadCatch (StateLazyC s m)
MonadMask
           , MonadBase b, MonadBaseControl b
           )
  deriving (m a -> StateLazyC s m a
(forall (m :: * -> *) a. Monad m => m a -> StateLazyC s m a)
-> MonadTrans (StateLazyC s)
forall s (m :: * -> *) a. Monad m => m a -> StateLazyC s m a
forall (m :: * -> *) a. Monad m => m a -> StateLazyC s m a
forall (t :: (* -> *) -> * -> *).
(forall (m :: * -> *) a. Monad m => m a -> t m a) -> MonadTrans t
lift :: m a -> StateLazyC s m a
$clift :: forall s (m :: * -> *) a. Monad m => m a -> StateLazyC s m a
MonadTrans, MonadTrans (StateLazyC s)
m (StT (StateLazyC s) a) -> StateLazyC s m a
MonadTrans (StateLazyC s)
-> (forall (m :: * -> *) a.
    Monad m =>
    (Run (StateLazyC s) -> m a) -> StateLazyC s m a)
-> (forall (m :: * -> *) a.
    Monad m =>
    m (StT (StateLazyC s) a) -> StateLazyC s m a)
-> MonadTransControl (StateLazyC s)
(Run (StateLazyC s) -> m a) -> StateLazyC s m a
forall s. MonadTrans (StateLazyC s)
forall s (m :: * -> *) a.
Monad m =>
m (StT (StateLazyC s) a) -> StateLazyC s m a
forall s (m :: * -> *) a.
Monad m =>
(Run (StateLazyC s) -> m a) -> StateLazyC s m a
forall (m :: * -> *) a.
Monad m =>
m (StT (StateLazyC s) a) -> StateLazyC s m a
forall (m :: * -> *) a.
Monad m =>
(Run (StateLazyC s) -> m a) -> StateLazyC s m a
forall (t :: (* -> *) -> * -> *).
MonadTrans t
-> (forall (m :: * -> *) a. Monad m => (Run t -> m a) -> t m a)
-> (forall (m :: * -> *) a. Monad m => m (StT t a) -> t m a)
-> MonadTransControl t
restoreT :: m (StT (StateLazyC s) a) -> StateLazyC s m a
$crestoreT :: forall s (m :: * -> *) a.
Monad m =>
m (StT (StateLazyC s) a) -> StateLazyC s m a
liftWith :: (Run (StateLazyC s) -> m a) -> StateLazyC s m a
$cliftWith :: forall s (m :: * -> *) a.
Monad m =>
(Run (StateLazyC s) -> m a) -> StateLazyC s m a
$cp1MonadTransControl :: forall s. MonadTrans (StateLazyC s)
MonadTransControl)

instance ( Carrier m
         , Threads (LSt.StateT s) (Prims m)
         )
      => Carrier (StateLazyC s m) where
  type Derivs (StateLazyC s m) = State s ': Derivs m
  type Prims  (StateLazyC s m) = Prims m

  algPrims :: Algebra' (Prims (StateLazyC s m)) (StateLazyC s m) a
algPrims = (Union (Prims m) (StateT s m) a -> StateT s m a)
-> Algebra' (Prims m) (StateLazyC s m) a
coerce (Algebra (Prims m) m -> Algebra (Prims m) (StateT s m)
forall (t :: (* -> *) -> * -> *) (p :: [(* -> *) -> * -> *])
       (m :: * -> *).
(Threads t p, Monad m) =>
Algebra p m -> Algebra p (t m)
thread @(LSt.StateT s) (Carrier m => Algebra (Prims m) m
forall (m :: * -> *) a. Carrier m => Algebra' (Prims m) m a
algPrims @m))
  {-# INLINEABLE algPrims #-}

  reformulate :: Reformulation'
  (Derivs (StateLazyC s m))
  (Prims (StateLazyC s m))
  (StateLazyC s m)
  z
  a
reformulate forall x. StateLazyC s m x -> z x
n Algebra (Prims (StateLazyC s m)) z
alg = Algebra' (Derivs m) z a
-> (State s z a -> z a) -> Algebra' (State s : Derivs m) z a
forall (e :: (* -> *) -> * -> *) (r :: [(* -> *) -> * -> *])
       (m :: * -> *) a.
RepresentationalEff e =>
Algebra' r m a -> (e m a -> m a) -> Algebra' (e : r) m a
powerAlg (Reformulation' (Derivs m) (Prims m) m z a
forall (m :: * -> *) (z :: * -> *) a.
(Carrier m, Monad z) =>
Reformulation' (Derivs m) (Prims m) m z a
reformulate (StateLazyC s m x -> z x
forall x. StateLazyC s m x -> z x
n (StateLazyC s m x -> z x)
-> (m x -> StateLazyC s m x) -> m x -> z x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. m x -> StateLazyC s m x
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift) forall x. Union (Prims m) z x -> z x
Algebra (Prims (StateLazyC s m)) z
alg) ((State s z a -> z a) -> Algebra' (State s : Derivs m) z a)
-> (State s z a -> z a) -> Algebra' (State s : Derivs m) z a
forall a b. (a -> b) -> a -> b
$ \case
    Put s
s -> StateLazyC s m () -> z ()
forall x. StateLazyC s m x -> z x
n (StateLazyC s m () -> z ()) -> StateLazyC s m () -> z ()
forall a b. (a -> b) -> a -> b
$ StateT s m () -> StateLazyC s m ()
forall s (m :: * -> *) a. StateT s m a -> StateLazyC s m a
StateLazyC (StateT s m () -> StateLazyC s m ())
-> StateT s m () -> StateLazyC s m ()
forall a b. (a -> b) -> a -> b
$ s -> StateT s m ()
forall (m :: * -> *) s. Monad m => s -> StateT s m ()
LSt.put s
s
    State s z a
Get   -> StateLazyC s m s -> z s
forall x. StateLazyC s m x -> z x
n (StateT s m s -> StateLazyC s m s
forall s (m :: * -> *) a. StateT s m a -> StateLazyC s m a
StateLazyC StateT s m s
forall (m :: * -> *) s. Monad m => StateT s m s
LSt.get)
  {-# INLINEABLE reformulate #-}

-- | 'StateLazyThreads' accepts the following primitive effects:
--
-- * 'Control.Effect.Regional.Regional' @s@
-- * 'Control.Effect.Optional.Optional' @s@ (when @s@ is a functor)
-- * 'Control.Effect.BaseControl.BaseControl' @b@
-- * 'Control.Effect.Type.ListenPrim.ListenPrim' @o@ (when @o@ is a 'Monoid')
-- * 'Control.Effect.Type.WriterPrim.WriterPrim' @o@ (when @o@ is a 'Monoid')
-- * 'Control.Effect.Type.ReaderPrim.ReaderPrim' @i@
-- * 'Control.Effect.Mask.Mask'
-- * 'Control.Effect.Bracket.Bracket'
-- * 'Control.Effect.Fix.Fix'
-- * 'Control.Effect.NonDet.Split'
class    ( forall s. Threads (LSt.StateT s) p
         ) => StateLazyThreads p
instance ( forall s. Threads (LSt.StateT s) p
         ) => StateLazyThreads p

-- | 'StateThreads' accepts the following primitive effects:
--
-- * 'Control.Effect.Regional.Regional' @s@
-- * 'Control.Effect.Optional.Optional' @s@ (when @s@ is a functor)
-- * 'Control.Effect.BaseControl.BaseControl' @b@
-- * 'Control.Effect.Type.ListenPrim.ListenPrim' @o@ (when @o@ is a 'Monoid')
-- * 'Control.Effect.Type.WriterPrim.WriterPrim' @o@ (when @o@ is a 'Monoid')
-- * 'Control.Effect.Type.ReaderPrim.ReaderPrim' @i@
-- * 'Control.Effect.Mask.Mask'
-- * 'Control.Effect.Bracket.Bracket'
-- * 'Control.Effect.Fix.Fix'
-- * 'Control.Effect.NonDet.Split'
class    ( forall s. Threads (SSt.StateT s) p
         ) => StateThreads p
instance ( forall s. Threads (SSt.StateT s) p
         ) => StateThreads p