{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE QuantifiedConstraints #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UnboxedTuples #-}
{-# LANGUAGE UndecidableInstances #-}

{-# OPTIONS_GHC -Wno-orphans #-}
{-# OPTIONS_GHC -Wno-simplifiable-class-constraints #-}

{-# OPTIONS_HADDOCK hide #-}

module Capability.State.Internal.Strategies.Common
  ( MonadState(..)
  , ReaderIORef(..)
  , ReaderRef(..)
  ) where

import Control.Monad.IO.Class (MonadIO)
import Control.Monad.Primitive (PrimMonad)
import Data.Kind (Type)

-- | Derive 'HasState' from @m@'s
-- 'Control.Monad.State.Class.MonadState' instance.
newtype MonadState (m :: Type -> Type) (a :: Type) = MonadState (m a)
  deriving (a -> MonadState m b -> MonadState m a
(a -> b) -> MonadState m a -> MonadState m b
(forall a b. (a -> b) -> MonadState m a -> MonadState m b)
-> (forall a b. a -> MonadState m b -> MonadState m a)
-> Functor (MonadState m)
forall a b. a -> MonadState m b -> MonadState m a
forall a b. (a -> b) -> MonadState m a -> MonadState m b
forall (m :: * -> *) a b.
Functor m =>
a -> MonadState m b -> MonadState m a
forall (m :: * -> *) a b.
Functor m =>
(a -> b) -> MonadState m a -> MonadState m b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> MonadState m b -> MonadState m a
$c<$ :: forall (m :: * -> *) a b.
Functor m =>
a -> MonadState m b -> MonadState m a
fmap :: (a -> b) -> MonadState m a -> MonadState m b
$cfmap :: forall (m :: * -> *) a b.
Functor m =>
(a -> b) -> MonadState m a -> MonadState m b
Functor, Functor (MonadState m)
a -> MonadState m a
Functor (MonadState m)
-> (forall a. a -> MonadState m a)
-> (forall a b.
    MonadState m (a -> b) -> MonadState m a -> MonadState m b)
-> (forall a b c.
    (a -> b -> c)
    -> MonadState m a -> MonadState m b -> MonadState m c)
-> (forall a b. MonadState m a -> MonadState m b -> MonadState m b)
-> (forall a b. MonadState m a -> MonadState m b -> MonadState m a)
-> Applicative (MonadState m)
MonadState m a -> MonadState m b -> MonadState m b
MonadState m a -> MonadState m b -> MonadState m a
MonadState m (a -> b) -> MonadState m a -> MonadState m b
(a -> b -> c) -> MonadState m a -> MonadState m b -> MonadState m c
forall a. a -> MonadState m a
forall a b. MonadState m a -> MonadState m b -> MonadState m a
forall a b. MonadState m a -> MonadState m b -> MonadState m b
forall a b.
MonadState m (a -> b) -> MonadState m a -> MonadState m b
forall a b c.
(a -> b -> c) -> MonadState m a -> MonadState m b -> MonadState 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
forall (m :: * -> *). Applicative m => Functor (MonadState m)
forall (m :: * -> *) a. Applicative m => a -> MonadState m a
forall (m :: * -> *) a b.
Applicative m =>
MonadState m a -> MonadState m b -> MonadState m a
forall (m :: * -> *) a b.
Applicative m =>
MonadState m a -> MonadState m b -> MonadState m b
forall (m :: * -> *) a b.
Applicative m =>
MonadState m (a -> b) -> MonadState m a -> MonadState m b
forall (m :: * -> *) a b c.
Applicative m =>
(a -> b -> c) -> MonadState m a -> MonadState m b -> MonadState m c
<* :: MonadState m a -> MonadState m b -> MonadState m a
$c<* :: forall (m :: * -> *) a b.
Applicative m =>
MonadState m a -> MonadState m b -> MonadState m a
*> :: MonadState m a -> MonadState m b -> MonadState m b
$c*> :: forall (m :: * -> *) a b.
Applicative m =>
MonadState m a -> MonadState m b -> MonadState m b
liftA2 :: (a -> b -> c) -> MonadState m a -> MonadState m b -> MonadState m c
$cliftA2 :: forall (m :: * -> *) a b c.
Applicative m =>
(a -> b -> c) -> MonadState m a -> MonadState m b -> MonadState m c
<*> :: MonadState m (a -> b) -> MonadState m a -> MonadState m b
$c<*> :: forall (m :: * -> *) a b.
Applicative m =>
MonadState m (a -> b) -> MonadState m a -> MonadState m b
pure :: a -> MonadState m a
$cpure :: forall (m :: * -> *) a. Applicative m => a -> MonadState m a
$cp1Applicative :: forall (m :: * -> *). Applicative m => Functor (MonadState m)
Applicative, Applicative (MonadState m)
a -> MonadState m a
Applicative (MonadState m)
-> (forall a b.
    MonadState m a -> (a -> MonadState m b) -> MonadState m b)
-> (forall a b. MonadState m a -> MonadState m b -> MonadState m b)
-> (forall a. a -> MonadState m a)
-> Monad (MonadState m)
MonadState m a -> (a -> MonadState m b) -> MonadState m b
MonadState m a -> MonadState m b -> MonadState m b
forall a. a -> MonadState m a
forall a b. MonadState m a -> MonadState m b -> MonadState m b
forall a b.
MonadState m a -> (a -> MonadState m b) -> MonadState m b
forall (m :: * -> *). Monad m => Applicative (MonadState m)
forall (m :: * -> *) a. Monad m => a -> MonadState m a
forall (m :: * -> *) a b.
Monad m =>
MonadState m a -> MonadState m b -> MonadState m b
forall (m :: * -> *) a b.
Monad m =>
MonadState m a -> (a -> MonadState m b) -> MonadState 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 -> MonadState m a
$creturn :: forall (m :: * -> *) a. Monad m => a -> MonadState m a
>> :: MonadState m a -> MonadState m b -> MonadState m b
$c>> :: forall (m :: * -> *) a b.
Monad m =>
MonadState m a -> MonadState m b -> MonadState m b
>>= :: MonadState m a -> (a -> MonadState m b) -> MonadState m b
$c>>= :: forall (m :: * -> *) a b.
Monad m =>
MonadState m a -> (a -> MonadState m b) -> MonadState m b
$cp1Monad :: forall (m :: * -> *). Monad m => Applicative (MonadState m)
Monad, Monad (MonadState m)
Monad (MonadState m)
-> (forall a. IO a -> MonadState m a) -> MonadIO (MonadState m)
IO a -> MonadState m a
forall a. IO a -> MonadState m a
forall (m :: * -> *).
Monad m -> (forall a. IO a -> m a) -> MonadIO m
forall (m :: * -> *). MonadIO m => Monad (MonadState m)
forall (m :: * -> *) a. MonadIO m => IO a -> MonadState m a
liftIO :: IO a -> MonadState m a
$cliftIO :: forall (m :: * -> *) a. MonadIO m => IO a -> MonadState m a
$cp1MonadIO :: forall (m :: * -> *). MonadIO m => Monad (MonadState m)
MonadIO, Monad (MonadState m)
Monad (MonadState m)
-> (forall a.
    (State# (PrimState (MonadState m))
     -> (# State# (PrimState (MonadState m)), a #))
    -> MonadState m a)
-> PrimMonad (MonadState m)
(State# (PrimState (MonadState m))
 -> (# State# (PrimState (MonadState m)), a #))
-> MonadState m a
forall a.
(State# (PrimState (MonadState m))
 -> (# State# (PrimState (MonadState m)), a #))
-> MonadState m a
forall (m :: * -> *).
Monad m
-> (forall a.
    (State# (PrimState m) -> (# State# (PrimState m), a #)) -> m a)
-> PrimMonad m
forall (m :: * -> *). PrimMonad m => Monad (MonadState m)
forall (m :: * -> *) a.
PrimMonad m =>
(State# (PrimState (MonadState m))
 -> (# State# (PrimState (MonadState m)), a #))
-> MonadState m a
primitive :: (State# (PrimState (MonadState m))
 -> (# State# (PrimState (MonadState m)), a #))
-> MonadState m a
$cprimitive :: forall (m :: * -> *) a.
PrimMonad m =>
(State# (PrimState (MonadState m))
 -> (# State# (PrimState (MonadState m)), a #))
-> MonadState m a
$cp1PrimMonad :: forall (m :: * -> *). PrimMonad m => Monad (MonadState m)
PrimMonad)

-- | Derive a state monad from a reader over an 'Data.IORef.IORef'.
--
-- Example:
--
-- > newtype MyState m a = MyState (ReaderT (IORef Int) m a)
-- >   deriving (Functor, Applicative, Monad)
-- >   deriving HasState "foo" Int via
-- >     ReaderIORef (MonadReader (ReaderT (IORef Int) m))
--
-- See 'ReaderRef' for a more generic strategy.
newtype ReaderIORef m a = ReaderIORef (m a)
  deriving (a -> ReaderIORef m b -> ReaderIORef m a
(a -> b) -> ReaderIORef m a -> ReaderIORef m b
(forall a b. (a -> b) -> ReaderIORef m a -> ReaderIORef m b)
-> (forall a b. a -> ReaderIORef m b -> ReaderIORef m a)
-> Functor (ReaderIORef m)
forall a b. a -> ReaderIORef m b -> ReaderIORef m a
forall a b. (a -> b) -> ReaderIORef m a -> ReaderIORef m b
forall (m :: * -> *) a b.
Functor m =>
a -> ReaderIORef m b -> ReaderIORef m a
forall (m :: * -> *) a b.
Functor m =>
(a -> b) -> ReaderIORef m a -> ReaderIORef m b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> ReaderIORef m b -> ReaderIORef m a
$c<$ :: forall (m :: * -> *) a b.
Functor m =>
a -> ReaderIORef m b -> ReaderIORef m a
fmap :: (a -> b) -> ReaderIORef m a -> ReaderIORef m b
$cfmap :: forall (m :: * -> *) a b.
Functor m =>
(a -> b) -> ReaderIORef m a -> ReaderIORef m b
Functor, Functor (ReaderIORef m)
a -> ReaderIORef m a
Functor (ReaderIORef m)
-> (forall a. a -> ReaderIORef m a)
-> (forall a b.
    ReaderIORef m (a -> b) -> ReaderIORef m a -> ReaderIORef m b)
-> (forall a b c.
    (a -> b -> c)
    -> ReaderIORef m a -> ReaderIORef m b -> ReaderIORef m c)
-> (forall a b.
    ReaderIORef m a -> ReaderIORef m b -> ReaderIORef m b)
-> (forall a b.
    ReaderIORef m a -> ReaderIORef m b -> ReaderIORef m a)
-> Applicative (ReaderIORef m)
ReaderIORef m a -> ReaderIORef m b -> ReaderIORef m b
ReaderIORef m a -> ReaderIORef m b -> ReaderIORef m a
ReaderIORef m (a -> b) -> ReaderIORef m a -> ReaderIORef m b
(a -> b -> c)
-> ReaderIORef m a -> ReaderIORef m b -> ReaderIORef m c
forall a. a -> ReaderIORef m a
forall a b. ReaderIORef m a -> ReaderIORef m b -> ReaderIORef m a
forall a b. ReaderIORef m a -> ReaderIORef m b -> ReaderIORef m b
forall a b.
ReaderIORef m (a -> b) -> ReaderIORef m a -> ReaderIORef m b
forall a b c.
(a -> b -> c)
-> ReaderIORef m a -> ReaderIORef m b -> ReaderIORef 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
forall (m :: * -> *). Applicative m => Functor (ReaderIORef m)
forall (m :: * -> *) a. Applicative m => a -> ReaderIORef m a
forall (m :: * -> *) a b.
Applicative m =>
ReaderIORef m a -> ReaderIORef m b -> ReaderIORef m a
forall (m :: * -> *) a b.
Applicative m =>
ReaderIORef m a -> ReaderIORef m b -> ReaderIORef m b
forall (m :: * -> *) a b.
Applicative m =>
ReaderIORef m (a -> b) -> ReaderIORef m a -> ReaderIORef m b
forall (m :: * -> *) a b c.
Applicative m =>
(a -> b -> c)
-> ReaderIORef m a -> ReaderIORef m b -> ReaderIORef m c
<* :: ReaderIORef m a -> ReaderIORef m b -> ReaderIORef m a
$c<* :: forall (m :: * -> *) a b.
Applicative m =>
ReaderIORef m a -> ReaderIORef m b -> ReaderIORef m a
*> :: ReaderIORef m a -> ReaderIORef m b -> ReaderIORef m b
$c*> :: forall (m :: * -> *) a b.
Applicative m =>
ReaderIORef m a -> ReaderIORef m b -> ReaderIORef m b
liftA2 :: (a -> b -> c)
-> ReaderIORef m a -> ReaderIORef m b -> ReaderIORef m c
$cliftA2 :: forall (m :: * -> *) a b c.
Applicative m =>
(a -> b -> c)
-> ReaderIORef m a -> ReaderIORef m b -> ReaderIORef m c
<*> :: ReaderIORef m (a -> b) -> ReaderIORef m a -> ReaderIORef m b
$c<*> :: forall (m :: * -> *) a b.
Applicative m =>
ReaderIORef m (a -> b) -> ReaderIORef m a -> ReaderIORef m b
pure :: a -> ReaderIORef m a
$cpure :: forall (m :: * -> *) a. Applicative m => a -> ReaderIORef m a
$cp1Applicative :: forall (m :: * -> *). Applicative m => Functor (ReaderIORef m)
Applicative, Applicative (ReaderIORef m)
a -> ReaderIORef m a
Applicative (ReaderIORef m)
-> (forall a b.
    ReaderIORef m a -> (a -> ReaderIORef m b) -> ReaderIORef m b)
-> (forall a b.
    ReaderIORef m a -> ReaderIORef m b -> ReaderIORef m b)
-> (forall a. a -> ReaderIORef m a)
-> Monad (ReaderIORef m)
ReaderIORef m a -> (a -> ReaderIORef m b) -> ReaderIORef m b
ReaderIORef m a -> ReaderIORef m b -> ReaderIORef m b
forall a. a -> ReaderIORef m a
forall a b. ReaderIORef m a -> ReaderIORef m b -> ReaderIORef m b
forall a b.
ReaderIORef m a -> (a -> ReaderIORef m b) -> ReaderIORef m b
forall (m :: * -> *). Monad m => Applicative (ReaderIORef m)
forall (m :: * -> *) a. Monad m => a -> ReaderIORef m a
forall (m :: * -> *) a b.
Monad m =>
ReaderIORef m a -> ReaderIORef m b -> ReaderIORef m b
forall (m :: * -> *) a b.
Monad m =>
ReaderIORef m a -> (a -> ReaderIORef m b) -> ReaderIORef 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 -> ReaderIORef m a
$creturn :: forall (m :: * -> *) a. Monad m => a -> ReaderIORef m a
>> :: ReaderIORef m a -> ReaderIORef m b -> ReaderIORef m b
$c>> :: forall (m :: * -> *) a b.
Monad m =>
ReaderIORef m a -> ReaderIORef m b -> ReaderIORef m b
>>= :: ReaderIORef m a -> (a -> ReaderIORef m b) -> ReaderIORef m b
$c>>= :: forall (m :: * -> *) a b.
Monad m =>
ReaderIORef m a -> (a -> ReaderIORef m b) -> ReaderIORef m b
$cp1Monad :: forall (m :: * -> *). Monad m => Applicative (ReaderIORef m)
Monad)

-- | Derive a state monad from a reader over a mutable reference.
--
-- Mutable references are available in a 'Control.Monad.Primitive.PrimMonad'.
-- The corresponding 'Control.Monad.Primitive.PrimState' has to match the
-- 'Data.Mutable.MCState' of the reference. This constraint makes a stand-alone
-- deriving clause necessary.
--
-- Example:
--
-- > newtype MyState m a = MyState (ReaderT (IORef Int) m a)
-- >   deriving (Functor, Applicative, Monad)
-- > deriving via ReaderRef (MonadReader (ReaderT (IORef Int) m))
-- >   instance (PrimMonad m, PrimState m ~ PrimState IO)
-- >   => HasState "foo" Int (MyState m)
--
-- See 'ReaderIORef' for a specialized version over 'Data.IORef.IORef'.
newtype ReaderRef m (a :: Type) = ReaderRef (m a)
  deriving (a -> ReaderRef m b -> ReaderRef m a
(a -> b) -> ReaderRef m a -> ReaderRef m b
(forall a b. (a -> b) -> ReaderRef m a -> ReaderRef m b)
-> (forall a b. a -> ReaderRef m b -> ReaderRef m a)
-> Functor (ReaderRef m)
forall a b. a -> ReaderRef m b -> ReaderRef m a
forall a b. (a -> b) -> ReaderRef m a -> ReaderRef m b
forall (m :: * -> *) a b.
Functor m =>
a -> ReaderRef m b -> ReaderRef m a
forall (m :: * -> *) a b.
Functor m =>
(a -> b) -> ReaderRef m a -> ReaderRef m b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> ReaderRef m b -> ReaderRef m a
$c<$ :: forall (m :: * -> *) a b.
Functor m =>
a -> ReaderRef m b -> ReaderRef m a
fmap :: (a -> b) -> ReaderRef m a -> ReaderRef m b
$cfmap :: forall (m :: * -> *) a b.
Functor m =>
(a -> b) -> ReaderRef m a -> ReaderRef m b
Functor, Functor (ReaderRef m)
a -> ReaderRef m a
Functor (ReaderRef m)
-> (forall a. a -> ReaderRef m a)
-> (forall a b.
    ReaderRef m (a -> b) -> ReaderRef m a -> ReaderRef m b)
-> (forall a b c.
    (a -> b -> c) -> ReaderRef m a -> ReaderRef m b -> ReaderRef m c)
-> (forall a b. ReaderRef m a -> ReaderRef m b -> ReaderRef m b)
-> (forall a b. ReaderRef m a -> ReaderRef m b -> ReaderRef m a)
-> Applicative (ReaderRef m)
ReaderRef m a -> ReaderRef m b -> ReaderRef m b
ReaderRef m a -> ReaderRef m b -> ReaderRef m a
ReaderRef m (a -> b) -> ReaderRef m a -> ReaderRef m b
(a -> b -> c) -> ReaderRef m a -> ReaderRef m b -> ReaderRef m c
forall a. a -> ReaderRef m a
forall a b. ReaderRef m a -> ReaderRef m b -> ReaderRef m a
forall a b. ReaderRef m a -> ReaderRef m b -> ReaderRef m b
forall a b. ReaderRef m (a -> b) -> ReaderRef m a -> ReaderRef m b
forall a b c.
(a -> b -> c) -> ReaderRef m a -> ReaderRef m b -> ReaderRef 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
forall (m :: * -> *). Applicative m => Functor (ReaderRef m)
forall (m :: * -> *) a. Applicative m => a -> ReaderRef m a
forall (m :: * -> *) a b.
Applicative m =>
ReaderRef m a -> ReaderRef m b -> ReaderRef m a
forall (m :: * -> *) a b.
Applicative m =>
ReaderRef m a -> ReaderRef m b -> ReaderRef m b
forall (m :: * -> *) a b.
Applicative m =>
ReaderRef m (a -> b) -> ReaderRef m a -> ReaderRef m b
forall (m :: * -> *) a b c.
Applicative m =>
(a -> b -> c) -> ReaderRef m a -> ReaderRef m b -> ReaderRef m c
<* :: ReaderRef m a -> ReaderRef m b -> ReaderRef m a
$c<* :: forall (m :: * -> *) a b.
Applicative m =>
ReaderRef m a -> ReaderRef m b -> ReaderRef m a
*> :: ReaderRef m a -> ReaderRef m b -> ReaderRef m b
$c*> :: forall (m :: * -> *) a b.
Applicative m =>
ReaderRef m a -> ReaderRef m b -> ReaderRef m b
liftA2 :: (a -> b -> c) -> ReaderRef m a -> ReaderRef m b -> ReaderRef m c
$cliftA2 :: forall (m :: * -> *) a b c.
Applicative m =>
(a -> b -> c) -> ReaderRef m a -> ReaderRef m b -> ReaderRef m c
<*> :: ReaderRef m (a -> b) -> ReaderRef m a -> ReaderRef m b
$c<*> :: forall (m :: * -> *) a b.
Applicative m =>
ReaderRef m (a -> b) -> ReaderRef m a -> ReaderRef m b
pure :: a -> ReaderRef m a
$cpure :: forall (m :: * -> *) a. Applicative m => a -> ReaderRef m a
$cp1Applicative :: forall (m :: * -> *). Applicative m => Functor (ReaderRef m)
Applicative, Applicative (ReaderRef m)
a -> ReaderRef m a
Applicative (ReaderRef m)
-> (forall a b.
    ReaderRef m a -> (a -> ReaderRef m b) -> ReaderRef m b)
-> (forall a b. ReaderRef m a -> ReaderRef m b -> ReaderRef m b)
-> (forall a. a -> ReaderRef m a)
-> Monad (ReaderRef m)
ReaderRef m a -> (a -> ReaderRef m b) -> ReaderRef m b
ReaderRef m a -> ReaderRef m b -> ReaderRef m b
forall a. a -> ReaderRef m a
forall a b. ReaderRef m a -> ReaderRef m b -> ReaderRef m b
forall a b. ReaderRef m a -> (a -> ReaderRef m b) -> ReaderRef m b
forall (m :: * -> *). Monad m => Applicative (ReaderRef m)
forall (m :: * -> *) a. Monad m => a -> ReaderRef m a
forall (m :: * -> *) a b.
Monad m =>
ReaderRef m a -> ReaderRef m b -> ReaderRef m b
forall (m :: * -> *) a b.
Monad m =>
ReaderRef m a -> (a -> ReaderRef m b) -> ReaderRef 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 -> ReaderRef m a
$creturn :: forall (m :: * -> *) a. Monad m => a -> ReaderRef m a
>> :: ReaderRef m a -> ReaderRef m b -> ReaderRef m b
$c>> :: forall (m :: * -> *) a b.
Monad m =>
ReaderRef m a -> ReaderRef m b -> ReaderRef m b
>>= :: ReaderRef m a -> (a -> ReaderRef m b) -> ReaderRef m b
$c>>= :: forall (m :: * -> *) a b.
Monad m =>
ReaderRef m a -> (a -> ReaderRef m b) -> ReaderRef m b
$cp1Monad :: forall (m :: * -> *). Monad m => Applicative (ReaderRef m)
Monad, Monad (ReaderRef m)
Monad (ReaderRef m)
-> (forall a. IO a -> ReaderRef m a) -> MonadIO (ReaderRef m)
IO a -> ReaderRef m a
forall a. IO a -> ReaderRef m a
forall (m :: * -> *).
Monad m -> (forall a. IO a -> m a) -> MonadIO m
forall (m :: * -> *). MonadIO m => Monad (ReaderRef m)
forall (m :: * -> *) a. MonadIO m => IO a -> ReaderRef m a
liftIO :: IO a -> ReaderRef m a
$cliftIO :: forall (m :: * -> *) a. MonadIO m => IO a -> ReaderRef m a
$cp1MonadIO :: forall (m :: * -> *). MonadIO m => Monad (ReaderRef m)
MonadIO, Monad (ReaderRef m)
Monad (ReaderRef m)
-> (forall a.
    (State# (PrimState (ReaderRef m))
     -> (# State# (PrimState (ReaderRef m)), a #))
    -> ReaderRef m a)
-> PrimMonad (ReaderRef m)
(State# (PrimState (ReaderRef m))
 -> (# State# (PrimState (ReaderRef m)), a #))
-> ReaderRef m a
forall a.
(State# (PrimState (ReaderRef m))
 -> (# State# (PrimState (ReaderRef m)), a #))
-> ReaderRef m a
forall (m :: * -> *).
Monad m
-> (forall a.
    (State# (PrimState m) -> (# State# (PrimState m), a #)) -> m a)
-> PrimMonad m
forall (m :: * -> *). PrimMonad m => Monad (ReaderRef m)
forall (m :: * -> *) a.
PrimMonad m =>
(State# (PrimState (ReaderRef m))
 -> (# State# (PrimState (ReaderRef m)), a #))
-> ReaderRef m a
primitive :: (State# (PrimState (ReaderRef m))
 -> (# State# (PrimState (ReaderRef m)), a #))
-> ReaderRef m a
$cprimitive :: forall (m :: * -> *) a.
PrimMonad m =>
(State# (PrimState (ReaderRef m))
 -> (# State# (PrimState (ReaderRef m)), a #))
-> ReaderRef m a
$cp1PrimMonad :: forall (m :: * -> *). PrimMonad m => Monad (ReaderRef m)
PrimMonad)