{-# LANGUAGE UndecidableInstances #-}

module Blucontrol.Monad.Recolor.Print (
  RecolorPrintT
, runRecolorPrintT
) where

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

import Blucontrol.Monad.Recolor

newtype RecolorPrintT c m a = RecolorPrintT { RecolorPrintT c m a -> m a
unRecolorPrintT :: m a }
  deriving (Functor (RecolorPrintT c m)
a -> RecolorPrintT c m a
Functor (RecolorPrintT c m)
-> (forall a. a -> RecolorPrintT c m a)
-> (forall a b.
    RecolorPrintT c m (a -> b)
    -> RecolorPrintT c m a -> RecolorPrintT c m b)
-> (forall a b c.
    (a -> b -> c)
    -> RecolorPrintT c m a
    -> RecolorPrintT c m b
    -> RecolorPrintT c m c)
-> (forall a b.
    RecolorPrintT c m a -> RecolorPrintT c m b -> RecolorPrintT c m b)
-> (forall a b.
    RecolorPrintT c m a -> RecolorPrintT c m b -> RecolorPrintT c m a)
-> Applicative (RecolorPrintT c m)
RecolorPrintT c m a -> RecolorPrintT c m b -> RecolorPrintT c m b
RecolorPrintT c m a -> RecolorPrintT c m b -> RecolorPrintT c m a
RecolorPrintT c m (a -> b)
-> RecolorPrintT c m a -> RecolorPrintT c m b
(a -> b -> c)
-> RecolorPrintT c m a
-> RecolorPrintT c m b
-> RecolorPrintT c m c
forall a. a -> RecolorPrintT c m a
forall a b.
RecolorPrintT c m a -> RecolorPrintT c m b -> RecolorPrintT c m a
forall a b.
RecolorPrintT c m a -> RecolorPrintT c m b -> RecolorPrintT c m b
forall a b.
RecolorPrintT c m (a -> b)
-> RecolorPrintT c m a -> RecolorPrintT c m b
forall a b c.
(a -> b -> c)
-> RecolorPrintT c m a
-> RecolorPrintT c m b
-> RecolorPrintT c m c
forall c (m :: * -> *).
Applicative m =>
Functor (RecolorPrintT c m)
forall c (m :: * -> *) a. Applicative m => a -> RecolorPrintT c m a
forall c (m :: * -> *) a b.
Applicative m =>
RecolorPrintT c m a -> RecolorPrintT c m b -> RecolorPrintT c m a
forall c (m :: * -> *) a b.
Applicative m =>
RecolorPrintT c m a -> RecolorPrintT c m b -> RecolorPrintT c m b
forall c (m :: * -> *) a b.
Applicative m =>
RecolorPrintT c m (a -> b)
-> RecolorPrintT c m a -> RecolorPrintT c m b
forall c (m :: * -> *) a b c.
Applicative m =>
(a -> b -> c)
-> RecolorPrintT c m a
-> RecolorPrintT c m b
-> RecolorPrintT 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
<* :: RecolorPrintT c m a -> RecolorPrintT c m b -> RecolorPrintT c m a
$c<* :: forall c (m :: * -> *) a b.
Applicative m =>
RecolorPrintT c m a -> RecolorPrintT c m b -> RecolorPrintT c m a
*> :: RecolorPrintT c m a -> RecolorPrintT c m b -> RecolorPrintT c m b
$c*> :: forall c (m :: * -> *) a b.
Applicative m =>
RecolorPrintT c m a -> RecolorPrintT c m b -> RecolorPrintT c m b
liftA2 :: (a -> b -> c)
-> RecolorPrintT c m a
-> RecolorPrintT c m b
-> RecolorPrintT c m c
$cliftA2 :: forall c (m :: * -> *) a b c.
Applicative m =>
(a -> b -> c)
-> RecolorPrintT c m a
-> RecolorPrintT c m b
-> RecolorPrintT c m c
<*> :: RecolorPrintT c m (a -> b)
-> RecolorPrintT c m a -> RecolorPrintT c m b
$c<*> :: forall c (m :: * -> *) a b.
Applicative m =>
RecolorPrintT c m (a -> b)
-> RecolorPrintT c m a -> RecolorPrintT c m b
pure :: a -> RecolorPrintT c m a
$cpure :: forall c (m :: * -> *) a. Applicative m => a -> RecolorPrintT c m a
$cp1Applicative :: forall c (m :: * -> *).
Applicative m =>
Functor (RecolorPrintT c m)
Applicative, a -> RecolorPrintT c m b -> RecolorPrintT c m a
(a -> b) -> RecolorPrintT c m a -> RecolorPrintT c m b
(forall a b.
 (a -> b) -> RecolorPrintT c m a -> RecolorPrintT c m b)
-> (forall a b. a -> RecolorPrintT c m b -> RecolorPrintT c m a)
-> Functor (RecolorPrintT c m)
forall a b. a -> RecolorPrintT c m b -> RecolorPrintT c m a
forall a b. (a -> b) -> RecolorPrintT c m a -> RecolorPrintT c m b
forall c (m :: * -> *) a b.
Functor m =>
a -> RecolorPrintT c m b -> RecolorPrintT c m a
forall c (m :: * -> *) a b.
Functor m =>
(a -> b) -> RecolorPrintT c m a -> RecolorPrintT 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 -> RecolorPrintT c m b -> RecolorPrintT c m a
$c<$ :: forall c (m :: * -> *) a b.
Functor m =>
a -> RecolorPrintT c m b -> RecolorPrintT c m a
fmap :: (a -> b) -> RecolorPrintT c m a -> RecolorPrintT c m b
$cfmap :: forall c (m :: * -> *) a b.
Functor m =>
(a -> b) -> RecolorPrintT c m a -> RecolorPrintT c m b
Functor, Applicative (RecolorPrintT c m)
a -> RecolorPrintT c m a
Applicative (RecolorPrintT c m)
-> (forall a b.
    RecolorPrintT c m a
    -> (a -> RecolorPrintT c m b) -> RecolorPrintT c m b)
-> (forall a b.
    RecolorPrintT c m a -> RecolorPrintT c m b -> RecolorPrintT c m b)
-> (forall a. a -> RecolorPrintT c m a)
-> Monad (RecolorPrintT c m)
RecolorPrintT c m a
-> (a -> RecolorPrintT c m b) -> RecolorPrintT c m b
RecolorPrintT c m a -> RecolorPrintT c m b -> RecolorPrintT c m b
forall a. a -> RecolorPrintT c m a
forall a b.
RecolorPrintT c m a -> RecolorPrintT c m b -> RecolorPrintT c m b
forall a b.
RecolorPrintT c m a
-> (a -> RecolorPrintT c m b) -> RecolorPrintT c m b
forall c (m :: * -> *). Monad m => Applicative (RecolorPrintT c m)
forall c (m :: * -> *) a. Monad m => a -> RecolorPrintT c m a
forall c (m :: * -> *) a b.
Monad m =>
RecolorPrintT c m a -> RecolorPrintT c m b -> RecolorPrintT c m b
forall c (m :: * -> *) a b.
Monad m =>
RecolorPrintT c m a
-> (a -> RecolorPrintT c m b) -> RecolorPrintT 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 -> RecolorPrintT c m a
$creturn :: forall c (m :: * -> *) a. Monad m => a -> RecolorPrintT c m a
>> :: RecolorPrintT c m a -> RecolorPrintT c m b -> RecolorPrintT c m b
$c>> :: forall c (m :: * -> *) a b.
Monad m =>
RecolorPrintT c m a -> RecolorPrintT c m b -> RecolorPrintT c m b
>>= :: RecolorPrintT c m a
-> (a -> RecolorPrintT c m b) -> RecolorPrintT c m b
$c>>= :: forall c (m :: * -> *) a b.
Monad m =>
RecolorPrintT c m a
-> (a -> RecolorPrintT c m b) -> RecolorPrintT c m b
$cp1Monad :: forall c (m :: * -> *). Monad m => Applicative (RecolorPrintT c m)
Monad, MonadBase b, MonadBaseControl b)

instance MonadTrans (RecolorPrintT c) where
  lift :: m a -> RecolorPrintT c m a
lift = m a -> RecolorPrintT c m a
forall c (m :: * -> *) a. m a -> RecolorPrintT c m a
RecolorPrintT

instance MonadTransControl (RecolorPrintT c) where
  type StT (RecolorPrintT c) a = a
  liftWith :: (Run (RecolorPrintT c) -> m a) -> RecolorPrintT c m a
liftWith Run (RecolorPrintT c) -> m a
inner = m a -> RecolorPrintT c m a
forall c (m :: * -> *) a. m a -> RecolorPrintT c m a
RecolorPrintT (m a -> RecolorPrintT c m a) -> m a -> RecolorPrintT c m a
forall a b. (a -> b) -> a -> b
$ Run (RecolorPrintT c) -> m a
inner forall c (m :: * -> *) a. RecolorPrintT c m a -> m a
Run (RecolorPrintT c)
unRecolorPrintT
  restoreT :: m (StT (RecolorPrintT c) a) -> RecolorPrintT c m a
restoreT = m (StT (RecolorPrintT c) a) -> RecolorPrintT c m a
forall c (m :: * -> *) a. m a -> RecolorPrintT c m a
RecolorPrintT

instance (MonadBaseControl IO m, Show c) => MonadRecolor (RecolorPrintT c m) where
  type RecolorValue (RecolorPrintT c m) = c
  recolor :: RecolorValue (RecolorPrintT c m) -> RecolorPrintT c m ()
recolor = IO () -> RecolorPrintT c m ()
forall (b :: * -> *) (m :: * -> *) α. MonadBase b m => b α -> m α
liftBase (IO () -> RecolorPrintT c m ())
-> (c -> IO ()) -> c -> RecolorPrintT c m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. c -> IO ()
forall a. Show a => a -> IO ()
print

runRecolorPrintT :: RecolorPrintT c m a -> m a
runRecolorPrintT :: RecolorPrintT c m a -> m a
runRecolorPrintT = RecolorPrintT c m a -> m a
forall c (m :: * -> *) a. RecolorPrintT c m a -> m a
unRecolorPrintT