{-# LANGUAGE UndecidableInstances #-} module Blucontrol.Gamma.Const ( GammaConstT , runGammaConstT ) where import Control.Monad.Base import Control.Monad.Trans import Control.Monad.Trans.Control import Control.Monad.Reader import Blucontrol.Gamma import Blucontrol.RGB newtype GammaConstT c m a = GammaConstT { GammaConstT c m a -> ReaderT c m a unGammaConstT :: ReaderT c m a } deriving (Functor (GammaConstT c m) a -> GammaConstT c m a Functor (GammaConstT c m) -> (forall a. a -> GammaConstT c m a) -> (forall a b. GammaConstT c m (a -> b) -> GammaConstT c m a -> GammaConstT c m b) -> (forall a b c. (a -> b -> c) -> GammaConstT c m a -> GammaConstT c m b -> GammaConstT c m c) -> (forall a b. GammaConstT c m a -> GammaConstT c m b -> GammaConstT c m b) -> (forall a b. GammaConstT c m a -> GammaConstT c m b -> GammaConstT c m a) -> Applicative (GammaConstT c m) GammaConstT c m a -> GammaConstT c m b -> GammaConstT c m b GammaConstT c m a -> GammaConstT c m b -> GammaConstT c m a GammaConstT c m (a -> b) -> GammaConstT c m a -> GammaConstT c m b (a -> b -> c) -> GammaConstT c m a -> GammaConstT c m b -> GammaConstT c m c forall a. a -> GammaConstT c m a forall a b. GammaConstT c m a -> GammaConstT c m b -> GammaConstT c m a forall a b. GammaConstT c m a -> GammaConstT c m b -> GammaConstT c m b forall a b. GammaConstT c m (a -> b) -> GammaConstT c m a -> GammaConstT c m b forall a b c. (a -> b -> c) -> GammaConstT c m a -> GammaConstT c m b -> GammaConstT c m c forall c (m :: * -> *). Applicative m => Functor (GammaConstT c m) forall c (m :: * -> *) a. Applicative m => a -> GammaConstT c m a forall c (m :: * -> *) a b. Applicative m => GammaConstT c m a -> GammaConstT c m b -> GammaConstT c m a forall c (m :: * -> *) a b. Applicative m => GammaConstT c m a -> GammaConstT c m b -> GammaConstT c m b forall c (m :: * -> *) a b. Applicative m => GammaConstT c m (a -> b) -> GammaConstT c m a -> GammaConstT c m b forall c (m :: * -> *) a b c. Applicative m => (a -> b -> c) -> GammaConstT c m a -> GammaConstT c m b -> GammaConstT 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 <* :: GammaConstT c m a -> GammaConstT c m b -> GammaConstT c m a $c<* :: forall c (m :: * -> *) a b. Applicative m => GammaConstT c m a -> GammaConstT c m b -> GammaConstT c m a *> :: GammaConstT c m a -> GammaConstT c m b -> GammaConstT c m b $c*> :: forall c (m :: * -> *) a b. Applicative m => GammaConstT c m a -> GammaConstT c m b -> GammaConstT c m b liftA2 :: (a -> b -> c) -> GammaConstT c m a -> GammaConstT c m b -> GammaConstT c m c $cliftA2 :: forall c (m :: * -> *) a b c. Applicative m => (a -> b -> c) -> GammaConstT c m a -> GammaConstT c m b -> GammaConstT c m c <*> :: GammaConstT c m (a -> b) -> GammaConstT c m a -> GammaConstT c m b $c<*> :: forall c (m :: * -> *) a b. Applicative m => GammaConstT c m (a -> b) -> GammaConstT c m a -> GammaConstT c m b pure :: a -> GammaConstT c m a $cpure :: forall c (m :: * -> *) a. Applicative m => a -> GammaConstT c m a $cp1Applicative :: forall c (m :: * -> *). Applicative m => Functor (GammaConstT c m) Applicative, a -> GammaConstT c m b -> GammaConstT c m a (a -> b) -> GammaConstT c m a -> GammaConstT c m b (forall a b. (a -> b) -> GammaConstT c m a -> GammaConstT c m b) -> (forall a b. a -> GammaConstT c m b -> GammaConstT c m a) -> Functor (GammaConstT c m) forall a b. a -> GammaConstT c m b -> GammaConstT c m a forall a b. (a -> b) -> GammaConstT c m a -> GammaConstT c m b forall c (m :: * -> *) a b. Functor m => a -> GammaConstT c m b -> GammaConstT c m a forall c (m :: * -> *) a b. Functor m => (a -> b) -> GammaConstT c m a -> GammaConstT c m b forall (f :: * -> *). (forall a b. (a -> b) -> f a -> f b) -> (forall a b. a -> f b -> f a) -> Functor f <$ :: a -> GammaConstT c m b -> GammaConstT c m a $c<$ :: forall c (m :: * -> *) a b. Functor m => a -> GammaConstT c m b -> GammaConstT c m a fmap :: (a -> b) -> GammaConstT c m a -> GammaConstT c m b $cfmap :: forall c (m :: * -> *) a b. Functor m => (a -> b) -> GammaConstT c m a -> GammaConstT c m b Functor, Applicative (GammaConstT c m) a -> GammaConstT c m a Applicative (GammaConstT c m) -> (forall a b. GammaConstT c m a -> (a -> GammaConstT c m b) -> GammaConstT c m b) -> (forall a b. GammaConstT c m a -> GammaConstT c m b -> GammaConstT c m b) -> (forall a. a -> GammaConstT c m a) -> Monad (GammaConstT c m) GammaConstT c m a -> (a -> GammaConstT c m b) -> GammaConstT c m b GammaConstT c m a -> GammaConstT c m b -> GammaConstT c m b forall a. a -> GammaConstT c m a forall a b. GammaConstT c m a -> GammaConstT c m b -> GammaConstT c m b forall a b. GammaConstT c m a -> (a -> GammaConstT c m b) -> GammaConstT c m b forall c (m :: * -> *). Monad m => Applicative (GammaConstT c m) forall c (m :: * -> *) a. Monad m => a -> GammaConstT c m a forall c (m :: * -> *) a b. Monad m => GammaConstT c m a -> GammaConstT c m b -> GammaConstT c m b forall c (m :: * -> *) a b. Monad m => GammaConstT c m a -> (a -> GammaConstT c m b) -> GammaConstT 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 return :: a -> GammaConstT c m a $creturn :: forall c (m :: * -> *) a. Monad m => a -> GammaConstT c m a >> :: GammaConstT c m a -> GammaConstT c m b -> GammaConstT c m b $c>> :: forall c (m :: * -> *) a b. Monad m => GammaConstT c m a -> GammaConstT c m b -> GammaConstT c m b >>= :: GammaConstT c m a -> (a -> GammaConstT c m b) -> GammaConstT c m b $c>>= :: forall c (m :: * -> *) a b. Monad m => GammaConstT c m a -> (a -> GammaConstT c m b) -> GammaConstT c m b $cp1Monad :: forall c (m :: * -> *). Monad m => Applicative (GammaConstT c m) Monad, MonadBase b, MonadBaseControl b, m a -> GammaConstT c m a (forall (m :: * -> *) a. Monad m => m a -> GammaConstT c m a) -> MonadTrans (GammaConstT c) forall c (m :: * -> *) a. Monad m => m a -> GammaConstT c m a forall (m :: * -> *) a. Monad m => m a -> GammaConstT c m a forall (t :: (* -> *) -> * -> *). (forall (m :: * -> *) a. Monad m => m a -> t m a) -> MonadTrans t lift :: m a -> GammaConstT c m a $clift :: forall c (m :: * -> *) a. Monad m => m a -> GammaConstT c m a MonadTrans, MonadTrans (GammaConstT c) m (StT (GammaConstT c) a) -> GammaConstT c m a MonadTrans (GammaConstT c) -> (forall (m :: * -> *) a. Monad m => (Run (GammaConstT c) -> m a) -> GammaConstT c m a) -> (forall (m :: * -> *) a. Monad m => m (StT (GammaConstT c) a) -> GammaConstT c m a) -> MonadTransControl (GammaConstT c) (Run (GammaConstT c) -> m a) -> GammaConstT c m a forall c. MonadTrans (GammaConstT c) forall c (m :: * -> *) a. Monad m => m (StT (GammaConstT c) a) -> GammaConstT c m a forall c (m :: * -> *) a. Monad m => (Run (GammaConstT c) -> m a) -> GammaConstT c m a forall (m :: * -> *) a. Monad m => m (StT (GammaConstT c) a) -> GammaConstT c m a forall (m :: * -> *) a. Monad m => (Run (GammaConstT c) -> m a) -> GammaConstT 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 restoreT :: m (StT (GammaConstT c) a) -> GammaConstT c m a $crestoreT :: forall c (m :: * -> *) a. Monad m => m (StT (GammaConstT c) a) -> GammaConstT c m a liftWith :: (Run (GammaConstT c) -> m a) -> GammaConstT c m a $cliftWith :: forall c (m :: * -> *) a. Monad m => (Run (GammaConstT c) -> m a) -> GammaConstT c m a $cp1MonadTransControl :: forall c. MonadTrans (GammaConstT c) MonadTransControl) instance MonadReader r m => MonadReader r (GammaConstT c m) where ask :: GammaConstT c m r ask = m r -> GammaConstT c m r forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a lift m r forall r (m :: * -> *). MonadReader r m => m r ask local :: (r -> r) -> GammaConstT c m a -> GammaConstT c m a local r -> r f GammaConstT c m a tma = (Run (GammaConstT c) -> m a) -> GammaConstT c m a forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTransControl t, Monad m) => (Run t -> m a) -> t m a liftWith ((Run (GammaConstT c) -> m a) -> GammaConstT c m a) -> (Run (GammaConstT c) -> m a) -> GammaConstT c m a forall a b. (a -> b) -> a -> b $ \ Run (GammaConstT c) run -> (r -> r) -> m a -> m a forall r (m :: * -> *) a. MonadReader r m => (r -> r) -> m a -> m a local r -> r f (m a -> m a) -> m a -> m a forall a b. (a -> b) -> a -> b $ GammaConstT c m a -> m (StT (GammaConstT c) a) Run (GammaConstT c) run GammaConstT c m a tma instance (Monad m, RGB c) => MonadGamma (GammaConstT c m) where gamma :: GammaConstT c m Trichromaticity gamma = c -> Trichromaticity forall c. RGB c => c -> Trichromaticity toRGB (c -> Trichromaticity) -> GammaConstT c m c -> GammaConstT c m Trichromaticity forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> ReaderT c m c -> GammaConstT c m c forall c (m :: * -> *) a. ReaderT c m a -> GammaConstT c m a GammaConstT ReaderT c m c forall r (m :: * -> *). MonadReader r m => m r ask runGammaConstT :: RGB c => c -> GammaConstT c m a -> m a runGammaConstT :: c -> GammaConstT c m a -> m a runGammaConstT c rgb GammaConstT c m a tma = ReaderT c m a -> c -> m a forall r (m :: * -> *) a. ReaderT r m a -> r -> m a runReaderT (GammaConstT c m a -> ReaderT c m a forall c (m :: * -> *) a. GammaConstT c m a -> ReaderT c m a unGammaConstT GammaConstT c m a tma) c rgb