{-# LANGUAGE UndecidableInstances #-}

module Blucontrol.Monad.PrepareValue.Const (
  PrepareValueConstT
, runPrepareValueConstT
) where

import Control.Monad.Base
import Control.Monad.Trans
import Control.Monad.Trans.Control
import Control.Monad.Reader

import Blucontrol.Monad.PrepareValue

newtype PrepareValueConstT c m a = PrepareValueConstT { forall c (m :: * -> *) a. PrepareValueConstT c m a -> ReaderT c m a
unPrepareValueConstT :: ReaderT c m a }
  deriving (Functor (PrepareValueConstT c m)
Functor (PrepareValueConstT c m)
-> (forall a. a -> PrepareValueConstT c m a)
-> (forall a b.
    PrepareValueConstT c m (a -> b)
    -> PrepareValueConstT c m a -> PrepareValueConstT c m b)
-> (forall a b c.
    (a -> b -> c)
    -> PrepareValueConstT c m a
    -> PrepareValueConstT c m b
    -> PrepareValueConstT c m c)
-> (forall a b.
    PrepareValueConstT c m a
    -> PrepareValueConstT c m b -> PrepareValueConstT c m b)
-> (forall a b.
    PrepareValueConstT c m a
    -> PrepareValueConstT c m b -> PrepareValueConstT c m a)
-> Applicative (PrepareValueConstT c m)
forall a. a -> PrepareValueConstT c m a
forall a b.
PrepareValueConstT c m a
-> PrepareValueConstT c m b -> PrepareValueConstT c m a
forall a b.
PrepareValueConstT c m a
-> PrepareValueConstT c m b -> PrepareValueConstT c m b
forall a b.
PrepareValueConstT c m (a -> b)
-> PrepareValueConstT c m a -> PrepareValueConstT c m b
forall a b c.
(a -> b -> c)
-> PrepareValueConstT c m a
-> PrepareValueConstT c m b
-> PrepareValueConstT c m c
forall {c} {m :: * -> *}.
Applicative m =>
Functor (PrepareValueConstT c m)
forall c (m :: * -> *) a.
Applicative m =>
a -> PrepareValueConstT c m a
forall c (m :: * -> *) a b.
Applicative m =>
PrepareValueConstT c m a
-> PrepareValueConstT c m b -> PrepareValueConstT c m a
forall c (m :: * -> *) a b.
Applicative m =>
PrepareValueConstT c m a
-> PrepareValueConstT c m b -> PrepareValueConstT c m b
forall c (m :: * -> *) a b.
Applicative m =>
PrepareValueConstT c m (a -> b)
-> PrepareValueConstT c m a -> PrepareValueConstT c m b
forall c (m :: * -> *) a b c.
Applicative m =>
(a -> b -> c)
-> PrepareValueConstT c m a
-> PrepareValueConstT c m b
-> PrepareValueConstT c 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
$cpure :: forall c (m :: * -> *) a.
Applicative m =>
a -> PrepareValueConstT c m a
pure :: forall a. a -> PrepareValueConstT c m a
$c<*> :: forall c (m :: * -> *) a b.
Applicative m =>
PrepareValueConstT c m (a -> b)
-> PrepareValueConstT c m a -> PrepareValueConstT c m b
<*> :: forall a b.
PrepareValueConstT c m (a -> b)
-> PrepareValueConstT c m a -> PrepareValueConstT c m b
$cliftA2 :: forall c (m :: * -> *) a b c.
Applicative m =>
(a -> b -> c)
-> PrepareValueConstT c m a
-> PrepareValueConstT c m b
-> PrepareValueConstT c m c
liftA2 :: forall a b c.
(a -> b -> c)
-> PrepareValueConstT c m a
-> PrepareValueConstT c m b
-> PrepareValueConstT c m c
$c*> :: forall c (m :: * -> *) a b.
Applicative m =>
PrepareValueConstT c m a
-> PrepareValueConstT c m b -> PrepareValueConstT c m b
*> :: forall a b.
PrepareValueConstT c m a
-> PrepareValueConstT c m b -> PrepareValueConstT c m b
$c<* :: forall c (m :: * -> *) a b.
Applicative m =>
PrepareValueConstT c m a
-> PrepareValueConstT c m b -> PrepareValueConstT c m a
<* :: forall a b.
PrepareValueConstT c m a
-> PrepareValueConstT c m b -> PrepareValueConstT c m a
Applicative, (forall a b.
 (a -> b) -> PrepareValueConstT c m a -> PrepareValueConstT c m b)
-> (forall a b.
    a -> PrepareValueConstT c m b -> PrepareValueConstT c m a)
-> Functor (PrepareValueConstT c m)
forall a b.
a -> PrepareValueConstT c m b -> PrepareValueConstT c m a
forall a b.
(a -> b) -> PrepareValueConstT c m a -> PrepareValueConstT c m b
forall c (m :: * -> *) a b.
Functor m =>
a -> PrepareValueConstT c m b -> PrepareValueConstT c m a
forall c (m :: * -> *) a b.
Functor m =>
(a -> b) -> PrepareValueConstT c m a -> PrepareValueConstT c m b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
$cfmap :: forall c (m :: * -> *) a b.
Functor m =>
(a -> b) -> PrepareValueConstT c m a -> PrepareValueConstT c m b
fmap :: forall a b.
(a -> b) -> PrepareValueConstT c m a -> PrepareValueConstT c m b
$c<$ :: forall c (m :: * -> *) a b.
Functor m =>
a -> PrepareValueConstT c m b -> PrepareValueConstT c m a
<$ :: forall a b.
a -> PrepareValueConstT c m b -> PrepareValueConstT c m a
Functor, Applicative (PrepareValueConstT c m)
Applicative (PrepareValueConstT c m)
-> (forall a b.
    PrepareValueConstT c m a
    -> (a -> PrepareValueConstT c m b) -> PrepareValueConstT c m b)
-> (forall a b.
    PrepareValueConstT c m a
    -> PrepareValueConstT c m b -> PrepareValueConstT c m b)
-> (forall a. a -> PrepareValueConstT c m a)
-> Monad (PrepareValueConstT c m)
forall a. a -> PrepareValueConstT c m a
forall a b.
PrepareValueConstT c m a
-> PrepareValueConstT c m b -> PrepareValueConstT c m b
forall a b.
PrepareValueConstT c m a
-> (a -> PrepareValueConstT c m b) -> PrepareValueConstT c m b
forall {c} {m :: * -> *}.
Monad m =>
Applicative (PrepareValueConstT c m)
forall c (m :: * -> *) a. Monad m => a -> PrepareValueConstT c m a
forall c (m :: * -> *) a b.
Monad m =>
PrepareValueConstT c m a
-> PrepareValueConstT c m b -> PrepareValueConstT c m b
forall c (m :: * -> *) a b.
Monad m =>
PrepareValueConstT c m a
-> (a -> PrepareValueConstT c m b) -> PrepareValueConstT c 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
$c>>= :: forall c (m :: * -> *) a b.
Monad m =>
PrepareValueConstT c m a
-> (a -> PrepareValueConstT c m b) -> PrepareValueConstT c m b
>>= :: forall a b.
PrepareValueConstT c m a
-> (a -> PrepareValueConstT c m b) -> PrepareValueConstT c m b
$c>> :: forall c (m :: * -> *) a b.
Monad m =>
PrepareValueConstT c m a
-> PrepareValueConstT c m b -> PrepareValueConstT c m b
>> :: forall a b.
PrepareValueConstT c m a
-> PrepareValueConstT c m b -> PrepareValueConstT c m b
$creturn :: forall c (m :: * -> *) a. Monad m => a -> PrepareValueConstT c m a
return :: forall a. a -> PrepareValueConstT c m a
Monad, MonadBase b, MonadBaseControl b, (forall (m :: * -> *) a.
 Monad m =>
 m a -> PrepareValueConstT c m a)
-> MonadTrans (PrepareValueConstT c)
forall c (m :: * -> *) a.
Monad m =>
m a -> PrepareValueConstT c m a
forall (m :: * -> *) a. Monad m => m a -> PrepareValueConstT c m a
forall (t :: (* -> *) -> * -> *).
(forall (m :: * -> *) a. Monad m => m a -> t m a) -> MonadTrans t
$clift :: forall c (m :: * -> *) a.
Monad m =>
m a -> PrepareValueConstT c m a
lift :: forall (m :: * -> *) a. Monad m => m a -> PrepareValueConstT c m a
MonadTrans, MonadTrans (PrepareValueConstT c)
MonadTrans (PrepareValueConstT c)
-> (forall (m :: * -> *) a.
    Monad m =>
    (Run (PrepareValueConstT c) -> m a) -> PrepareValueConstT c m a)
-> (forall (m :: * -> *) a.
    Monad m =>
    m (StT (PrepareValueConstT c) a) -> PrepareValueConstT c m a)
-> MonadTransControl (PrepareValueConstT c)
forall c. MonadTrans (PrepareValueConstT c)
forall c (m :: * -> *) a.
Monad m =>
m (StT (PrepareValueConstT c) a) -> PrepareValueConstT c m a
forall c (m :: * -> *) a.
Monad m =>
(Run (PrepareValueConstT c) -> m a) -> PrepareValueConstT c m a
forall (m :: * -> *) a.
Monad m =>
m (StT (PrepareValueConstT c) a) -> PrepareValueConstT c m a
forall (m :: * -> *) a.
Monad m =>
(Run (PrepareValueConstT c) -> m a) -> PrepareValueConstT c 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
$cliftWith :: forall c (m :: * -> *) a.
Monad m =>
(Run (PrepareValueConstT c) -> m a) -> PrepareValueConstT c m a
liftWith :: forall (m :: * -> *) a.
Monad m =>
(Run (PrepareValueConstT c) -> m a) -> PrepareValueConstT c m a
$crestoreT :: forall c (m :: * -> *) a.
Monad m =>
m (StT (PrepareValueConstT c) a) -> PrepareValueConstT c m a
restoreT :: forall (m :: * -> *) a.
Monad m =>
m (StT (PrepareValueConstT c) a) -> PrepareValueConstT c m a
MonadTransControl)

instance Monad m => MonadPrepareValue (PrepareValueConstT c m) where
  type PreparedValue (PrepareValueConstT c m) = c
  preparedValue :: PrepareValueConstT c m (PreparedValue (PrepareValueConstT c m))
preparedValue = ReaderT c m c -> PrepareValueConstT c m c
forall c (m :: * -> *) a. ReaderT c m a -> PrepareValueConstT c m a
PrepareValueConstT ReaderT c m c
forall r (m :: * -> *). MonadReader r m => m r
ask

runPrepareValueConstT :: c -> PrepareValueConstT c m a -> m a
runPrepareValueConstT :: forall c (m :: * -> *) a. c -> PrepareValueConstT c m a -> m a
runPrepareValueConstT !c
rgb PrepareValueConstT c m a
tma = ReaderT c m a -> c -> m a
forall r (m :: * -> *) a. ReaderT r m a -> r -> m a
runReaderT (PrepareValueConstT c m a -> ReaderT c m a
forall c (m :: * -> *) a. PrepareValueConstT c m a -> ReaderT c m a
unPrepareValueConstT PrepareValueConstT c m a
tma) c
rgb