-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Enable more deeper level style of programming than the usual Control.xxx modules express -- -- This module enables more deeper level style of programming than the -- usual Control.xxx modules provides, especially for Applicative and -- Monad. @package deepcontrol @version 0.2.0.0 -- | This module enables you to program in applicative style for more -- deeper level than the usual Applicative module -- expresses. You would soon realize exactly what more deeper -- level means by reading the example codes in order, which are -- attached on the functions below. Note: all the braket-cover notation -- for Level-4 and Level-5 haven't been written yet. module DeepControl.Applicative -- | Alias for $. -- --
--   >>> (1+) |> 2
--   3
--   
(|>) :: (a -> b) -> a -> b -- | The auguments-flipped function for |>. -- --
--   >>> 1 <| (+2)
--   3 
--   
--   >>> 1 <|(+)|> 2
--   3 
--   
--   >>> 1 <|(+)|> 2 <|(*)|> 3
--   9
--   
-- --
--   >>> 1 <|(,)|> 2
--   (1,2)
--   
(<|) :: a -> (a -> b) -> b -- | Alias for pure. (*:) :: (Applicative f) => a -> f a -- | Alias for <$>. -- --
--   >>> (1+) |$> [2]
--   [3]
--   
(|$>) :: Functor f => (a -> b) -> f a -> f b -- | The auguments-flipped function for |$>. -- --
--   >>> [1] <$| (+2)
--   [3]
--   
-- --
--   >>> ("<"++)|$> ["a","b"] <$|(++">")
--   ["<a>","<b>"]
--   
(<$|) :: Functor f => f a -> (a -> b) -> f b -- | Alias for <*>. -- --
--   >>> [(1+)] |*> [2]
--   [3]
--   
-- --
--   >>> [1] <$|(+)|*> [2]
--   [3]
--   
--   >>> [1] <$|(+)|*> [0,1,2]
--   [1,2,3]
--   
--   >>> [0,1] <$|(+)|*> [2,3] <$|(^)|*> [4,5]
--   [16,32,81,243,81,243,256,1024]
--   
-- --
--   >>> foldr (\x acc -> x <$|(:)|*> acc) ((*:) []) [Just 1, Just 2,  Just 3]
--   Just [1,2,3]
--   
--   >>> foldr (\x acc -> x <$|(:)|*> acc) ((*:) []) [Just 1, Nothing, Just 3]
--   Nothing
--   
-- --
--   >>> filter (even <$|(&&)|*> (10 >)) [1..100]
--   [2,4,6,8]
--   
--   >>> filter (even <$|(&&)|*> (10 >) <$|(&&)|*> (5 <)) [1..100]
--   [6,8]
--   
(|*>) :: Applicative f => f (a -> b) -> f a -> f b -- | The auguments-flipped function for |*>. (<*|) :: Applicative f => f a -> f (a -> b) -> f b -- | Combination consisted of ket |*> and cover -- *:, defined as f |* x = f |*> (*:) x. -- --
--   >>> [(1+)] |* 2
--   [3]
--   
--   >>> [1] <$|(+)|* 2
--   [3]
--   
--   >>> [1] <$|(+)|* 2 <$|(*)|* 3
--   [9]
--   
-- --
--   >>> Just 1 <$|(,)|* 2
--   Just (1,2)
--   
(|*) :: Applicative f => f (a -> b) -> a -> f b -- | The auguments-flipped function for |*. -- --
--   >>> 1 *| [(+2)]
--   [3]
--   
--   >>> 1 *| [(+)] |* 2
--   [3]
--   
--   >>> 1 *|[(+),(-),(*),(^)]|* 2
--   [3,-1,2,1]
--   
-- --
--   >>> 1 *|Just (,)|* 2
--   Just (1,2)
--   
(*|) :: Applicative f => a -> f (a -> b) -> f b -- | Combination consisted of cover *: twice, defined as -- (**:) = (*:) . (*:). (**:) :: (Applicative f1, Applicative f2) => a -> f1 (f2 a) -- | Alias for *:. (*-) :: (Applicative f1, Applicative f2) => f2 a -> f1 (f2 a) -- | Combination consisted of cover *: and ket -- |$>, defined as (-*) = ((*:)|$>). (-*) :: (Applicative f1, Applicative f2) => f1 a -> f1 (f2 a) -- | Combination consisted of cover |$> twice, defined -- as (|$>>) = (|$>) . (|$>). -- --
--   >>> (+1) |$>> [[2]]
--   [[3]]
--   
(|$>>) :: (Functor f1, Functor f2) => (a -> b) -> f1 (f2 a) -> f1 (f2 b) -- | The auguments-flipped function for |$>> -- --
--   >>> [[2]] <<$| (+1)
--   [[3]]
--   
(<<$|) :: (Functor f1, Functor f2) => f1 (f2 a) -> (a -> b) -> f1 (f2 b) -- | The lifted function of |*>, defined as -- (|*>>) = liftA2 (|*>). -- --
--   >>> [Just 1] <<$|(+)|*>> [Just 2]
--   [Just 3]
--   
-- --
--   >>> [Just 1] <<$|(,)|*>> [Just 2]
--   [Just (1,2)]
--   
-- --
--   >>> [[1]] <<$|(+)|*>> [[2]] <<$|(-)|*>> [[3]]
--   [[0]]
--   
-- --
--   >>> foldr (\n acc -> n <<$|(+)|*>> acc) ((**:) 0) [Right (Just 1), Right (Just 2), Right (Just 3)] :: Either () (Maybe Int)
--   Right (Just 6)
--   
--   >>> foldr (\n acc -> n <<$|(+)|*>> acc) ((**:) 0) [Right (Just 1), Right Nothing, Right (Just 3)] :: Either () (Maybe Int)
--   Right Nothing
--   
--   >>> foldr (\n acc -> n <<$|(+)|*>> acc) ((**:) 0) [Right (Just 1), Right Nothing, Left ()]
--   Left ()
--   
(|*>>) :: (Applicative f1, Applicative f2) => f1 (f2 (a -> b)) -> f1 (f2 a) -> f1 (f2 b) -- | The lifted function of <*|, defined as -- (<<*|) = liftA2 (<*|). (<<*|) :: (Applicative f1, Applicative f2) => f1 (f2 a) -> f1 (f2 (a -> b)) -> f1 (f2 b) -- | Combination consisted of ket |*>> and cover -- **:, defined as f |** x = f |*>> (**:) -- x. -- --
--   >>> [Just 1] <<$|(+)|** 2
--   [Just 3]
--   
(|**) :: (Applicative f1, Applicative f2) => f1 (f2 (a -> b)) -> a -> f1 (f2 b) -- | The auguments-flipped function for |**. -- --
--   >>> 1 **|(+)|$>> [Just 2]
--   [Just 3]
--   
-- --
--   >>> 1 **|[Just (+)]|**  2
--   [Just 3]
--   
--   >>> 1 **|[Just (+), Just (-), Just (*), Nothing]|** 2
--   [Just 3,Just (-1),Just 2,Nothing]
--   
(**|) :: (Applicative f1, Applicative f2) => a -> f1 (f2 (a -> b)) -> f1 (f2 b) -- | Combination consisted of ket |*>> and cover -- -*, defined as f |-* x = f |*>> (-*) x. -- --
--   >>> [Just 1] <<$|(+)|-* [2]
--   [Just 3]
--   
(|-*) :: (Applicative f1, Applicative f2) => f1 (f2 (a -> b)) -> f1 a -> f1 (f2 b) -- | Combination consisted of ket |*>> and cover -- *-, defined as f |*- x = f |*>> (*-) x. -- --
--   >>> [Just 1] <<$|(+)|*- Just 2
--   [Just 3]
--   
(|*-) :: (Applicative f1, Applicative f2) => f1 (f2 (a -> b)) -> f2 a -> f1 (f2 b) -- | The auguments-flipped function for |-*. -- --
--   >>> [1] -*|(+)|$>> [Just 2]
--   [Just 3]
--   
(-*|) :: (Applicative f1, Applicative f2) => f1 a -> f1 (f2 (a -> b)) -> f1 (f2 b) -- | The auguments-flipped function for |*-. -- --
--   >>> Just 1 *-|(+)|$>> [Just 2]
--   [Just 3]
--   
--   >>> Just 1 *-|[Just (+)]|** 2
--   [Just 3]
--   
--   >>> Just 1 *-|[Just (+)]|*- Just 2
--   [Just 3]
--   
--   >>> [1] -*|[Just (+)]|*- Just 2
--   [Just 3]
--   
--   >>> [1] -*|[Just (+), Just (-), Just (*), Nothing]|*- Just 2
--   [Just 3,Just (-1),Just 2,Nothing]
--   
--   >>> [0,1] -*|[Just (+), Just (-), Just (*), Nothing]|*- Just 2
--   [Just 2,Just 3,Just (-2),Just (-1),Just 0,Just 2,Nothing,Nothing]
--   
-- --
--   >>> print 1 -*|return [\_ _ -> 3]|-* print 2
--   1
--   2
--   [3]
--   
(*-|) :: (Applicative f1, Applicative f2) => f2 a -> f1 (f2 (a -> b)) -> f1 (f2 b) -- | The lifted function of *>, defined as liftA2 -- (*>). (*>>) :: (Applicative f1, Applicative f2) => f1 (f2 a) -> f1 (f2 b) -> f1 (f2 b) -- | The lifted function of <*, defined as liftA2 -- (<*). (<<*) :: (Applicative f1, Applicative f2) => f1 (f2 a) -> f1 (f2 b) -> f1 (f2 a) -- | Combination consisted of sequence *>> and cover -- *:, defined as: -- -- a *-> x = (*:) a *>> x (*->) :: (Applicative f1, Applicative f2) => f2 a -> f1 (f2 b) -> f1 (f2 b) -- | Combination consisted of sequence <<* and cover -- *:, defined as: -- -- x <*- a = x <<* (*:) a (<*-) :: (Applicative f1, Applicative f2) => f1 (f2 b) -> f2 a -> f1 (f2 b) -- | Combination consisted of sequence *>> and cover -- -*, defined as: -- -- a -*> x = (-*) a *>> x (-*>) :: (Applicative f1, Applicative f2) => f1 a -> f1 (f2 b) -> f1 (f2 b) -- | Combination consisted of sequence <<* and cover -- -*, defined as: -- -- x <-* a = x <<* (-*) a (<-*) :: (Applicative f1, Applicative f2) => f1 (f2 b) -> f1 a -> f1 (f2 b) (***:) :: (Applicative f1, Applicative f2, Applicative f3) => a -> f1 (f2 (f3 a)) (**-) :: (Applicative f1, Applicative f2, Applicative f3) => f3 a -> f1 (f2 (f3 a)) (*-*) :: (Applicative f1, Applicative f2, Applicative f3) => f2 a -> f1 (f2 (f3 a)) (-**) :: (Applicative f1, Applicative f2, Applicative f3) => f1 a -> f1 (f2 (f3 a)) (--*) :: (Applicative f1, Applicative f2, Applicative f3) => f1 (f2 a) -> f1 (f2 (f3 a)) (-*-) :: (Applicative f1, Applicative f2, Applicative f3) => f1 (f3 a) -> f1 (f2 (f3 a)) (*--) :: (Applicative f1, Applicative f2, Applicative f3) => f2 (f3 a) -> f1 (f2 (f3 a)) (|$>>>) :: (Functor f1, Functor f2, Functor f3) => (a -> b) -> f1 (f2 (f3 a)) -> f1 (f2 (f3 b)) (<<<$|) :: (Functor f1, Functor f2, Functor f3) => f1 (f2 (f3 a)) -> (a -> b) -> f1 (f2 (f3 b)) (|*>>>) :: (Applicative f1, Applicative f2, Applicative f3) => f1 (f2 (f3 (a -> b))) -> f1 (f2 (f3 a)) -> f1 (f2 (f3 b)) (<<<*|) :: (Applicative f1, Applicative f2, Applicative f3) => f1 (f2 (f3 a)) -> f1 (f2 (f3 (a -> b))) -> f1 (f2 (f3 b)) (|***) :: (Applicative f1, Applicative f2, Applicative f3) => f1 (f2 (f3 (a -> b))) -> a -> f1 (f2 (f3 b)) (***|) :: (Applicative f1, Applicative f2, Applicative f3) => a -> f1 (f2 (f3 (a -> b))) -> f1 (f2 (f3 b)) (|-**) :: (Applicative f1, Applicative f2, Applicative f3) => f1 (f2 (f3 (a -> b))) -> f1 a -> f1 (f2 (f3 b)) (|*-*) :: (Applicative f1, Applicative f2, Applicative f3) => f1 (f2 (f3 (a -> b))) -> f2 a -> f1 (f2 (f3 b)) (|**-) :: (Applicative f1, Applicative f2, Applicative f3) => f1 (f2 (f3 (a -> b))) -> f3 a -> f1 (f2 (f3 b)) (|--*) :: (Applicative f1, Applicative f2, Applicative f3) => f1 (f2 (f3 (a -> b))) -> f1 (f2 a) -> f1 (f2 (f3 b)) (|-*-) :: (Applicative f1, Applicative f2, Applicative f3) => f1 (f2 (f3 (a -> b))) -> f1 (f3 a) -> f1 (f2 (f3 b)) (|*--) :: (Applicative f1, Applicative f2, Applicative f3) => f1 (f2 (f3 (a -> b))) -> f2 (f3 a) -> f1 (f2 (f3 b)) (-**|) :: (Applicative f1, Applicative f2, Applicative f3) => f1 a -> f1 (f2 (f3 (a -> b))) -> f1 (f2 (f3 b)) (*-*|) :: (Applicative f1, Applicative f2, Applicative f3) => f2 a -> f1 (f2 (f3 (a -> b))) -> f1 (f2 (f3 b)) (**-|) :: (Applicative f1, Applicative f2, Applicative f3) => f3 a -> f1 (f2 (f3 (a -> b))) -> f1 (f2 (f3 b)) (--*|) :: (Applicative f1, Applicative f2, Applicative f3) => f1 (f2 a) -> f1 (f2 (f3 (a -> b))) -> f1 (f2 (f3 b)) (-*-|) :: (Applicative f1, Applicative f2, Applicative f3) => f1 (f3 a) -> f1 (f2 (f3 (a -> b))) -> f1 (f2 (f3 b)) (*--|) :: (Applicative f1, Applicative f2, Applicative f3) => f2 (f3 a) -> f1 (f2 (f3 (a -> b))) -> f1 (f2 (f3 b)) (*>>>) :: (Applicative f1, Applicative f2, Applicative f3) => f1 (f2 (f3 a)) -> f1 (f2 (f3 b)) -> f1 (f2 (f3 b)) (<<<*) :: (Applicative f1, Applicative f2, Applicative f3) => f1 (f2 (f3 a)) -> f1 (f2 (f3 b)) -> f1 (f2 (f3 a)) (*-->) :: (Applicative f1, Applicative f2, Applicative f3) => f2 (f3 a) -> f1 (f2 (f3 b)) -> f1 (f2 (f3 b)) (-*->) :: (Applicative f1, Applicative f2, Applicative f3) => f1 (f3 a) -> f1 (f2 (f3 b)) -> f1 (f2 (f3 b)) (--*>) :: (Applicative f1, Applicative f2, Applicative f3) => f1 (f2 a) -> f1 (f2 (f3 b)) -> f1 (f2 (f3 b)) (**->) :: (Applicative f1, Applicative f2, Applicative f3) => f3 a -> f1 (f2 (f3 b)) -> f1 (f2 (f3 b)) (*-*>) :: (Applicative f1, Applicative f2, Applicative f3) => f2 a -> f1 (f2 (f3 b)) -> f1 (f2 (f3 b)) (-**>) :: (Applicative f1, Applicative f2, Applicative f3) => f1 a -> f1 (f2 (f3 b)) -> f1 (f2 (f3 b)) (<*--) :: (Applicative f1, Applicative f2, Applicative f3) => f1 (f2 (f3 b)) -> f2 (f3 a) -> f1 (f2 (f3 b)) (<-*-) :: (Applicative f1, Applicative f2, Applicative f3) => f1 (f2 (f3 b)) -> f1 (f3 a) -> f1 (f2 (f3 b)) (<--*) :: (Applicative f1, Applicative f2, Applicative f3) => f1 (f2 (f3 b)) -> f1 (f2 a) -> f1 (f2 (f3 b)) (<**-) :: (Applicative f1, Applicative f2, Applicative f3) => f1 (f2 (f3 b)) -> f3 a -> f1 (f2 (f3 b)) (<*-*) :: (Applicative f1, Applicative f2, Applicative f3) => f1 (f2 (f3 b)) -> f2 a -> f1 (f2 (f3 b)) (<-**) :: (Applicative f1, Applicative f2, Applicative f3) => f1 (f2 (f3 b)) -> f1 a -> f1 (f2 (f3 b)) (****:) :: (Applicative f1, Applicative f2, Applicative f3, Applicative f4) => a -> f1 (f2 (f3 (f4 a))) (|$>>>>) :: (Functor f1, Functor f2, Functor f3, Functor f4) => (a -> b) -> f1 (f2 (f3 (f4 a))) -> f1 (f2 (f3 (f4 b))) (<<<<$|) :: (Functor f1, Functor f2, Functor f3, Functor f4) => f1 (f2 (f3 (f4 a))) -> (a -> b) -> f1 (f2 (f3 (f4 b))) (|*>>>>) :: (Applicative f1, Applicative f2, Applicative f3, Applicative f4) => f1 (f2 (f3 (f4 (a -> b)))) -> f1 (f2 (f3 (f4 a))) -> f1 (f2 (f3 (f4 b))) (<<<<*|) :: (Applicative f1, Applicative f2, Applicative f3, Applicative f4) => f1 (f2 (f3 (f4 a))) -> f1 (f2 (f3 (f4 (a -> b)))) -> f1 (f2 (f3 (f4 b))) (*>>>>) :: (Applicative f1, Applicative f2, Applicative f3, Applicative f4) => f1 (f2 (f3 (f4 a))) -> f1 (f2 (f3 (f4 b))) -> f1 (f2 (f3 (f4 b))) (<<<<*) :: (Applicative f1, Applicative f2, Applicative f3, Applicative f4) => f1 (f2 (f3 (f4 a))) -> f1 (f2 (f3 (f4 b))) -> f1 (f2 (f3 (f4 a))) (*****:) :: (Applicative f1, Applicative f2, Applicative f3, Applicative f4, Applicative f5) => a -> f1 (f2 (f3 (f4 (f5 a)))) (|$>>>>>) :: (Functor f1, Functor f2, Functor f3, Functor f4, Functor f5) => (a -> b) -> f1 (f2 (f3 (f4 (f5 a)))) -> f1 (f2 (f3 (f4 (f5 b)))) (<<<<<$|) :: (Functor f1, Functor f2, Functor f3, Functor f4, Functor f5) => f1 (f2 (f3 (f4 (f5 a)))) -> (a -> b) -> f1 (f2 (f3 (f4 (f5 b)))) (|*>>>>>) :: (Applicative f1, Applicative f2, Applicative f3, Applicative f4, Applicative f5) => f1 (f2 (f3 (f4 (f5 (a -> b))))) -> f1 (f2 (f3 (f4 (f5 a)))) -> f1 (f2 (f3 (f4 (f5 b)))) (<<<<<*|) :: (Applicative f1, Applicative f2, Applicative f3, Applicative f4, Applicative f5) => f1 (f2 (f3 (f4 (f5 a)))) -> f1 (f2 (f3 (f4 (f5 (a -> b))))) -> f1 (f2 (f3 (f4 (f5 b)))) (*>>>>>) :: (Applicative f1, Applicative f2, Applicative f3, Applicative f4, Applicative f5) => f1 (f2 (f3 (f4 (f5 a)))) -> f1 (f2 (f3 (f4 (f5 b)))) -> f1 (f2 (f3 (f4 (f5 b)))) (<<<<<*) :: (Applicative f1, Applicative f2, Applicative f3, Applicative f4, Applicative f5) => f1 (f2 (f3 (f4 (f5 a)))) -> f1 (f2 (f3 (f4 (f5 b)))) -> f1 (f2 (f3 (f4 (f5 a)))) -- | This module enables you to program in Monad for more deeper -- level than the usual Monad module expresses. You would soon -- realize exactly what more deeper level means by reading -- the example codes in order, which are attached on the Monadx(Monad2, -- Monad3, etc) classes below. -- -- Note: -- -- module DeepControl.Monad -- | Alias for $. -- --
--   >>> Just -< 3
--   Just 3
--   
(-<) :: (a -> b) -> a -> b -- | The auguments-flipped function for -<. -- --
--   >>> 3 >- Just
--   Just 3
--   
(>-) :: a -> (a -> b) -> b -- | The auguments-flipped function for <-<. -- --
--   >>> 1 >- ((+1) >-> (*2) >-> (+3))
--   7
--   
(>->) :: (a -> b) -> (b -> c) -> a -> c -- | Alias for .. -- --
--   >>> ((3+) <-< (2*) <-< (1+)) -< 1
--   7
--   
(<-<) :: (b -> c) -> (a -> b) -> a -> c -- | The auguments-flipped function for >>. (<<) :: Monad m => m b -> m a -> m b -- | The Monad2 class defines the Monad functions for level-2 types -- m1 (m2 a); such as [[a]], Maybe [a], Either () (Maybe a), a -- -> [b], IO [a], etc. -- --
--   >>> :{
--    [["a","b"]] >>== \x -> 
--    [[0],[1,2]] >>== \y -> 
--    (**:) $ x ++ show y
--   :}
--   [["a0","b0"],["a0","b1","b2"],["a1","a2","b0"],["a1","a2","b1","b2"]]
--   
-- --
--   >>> :{
--    let 
--      isJust (Just _) = True
--      isJust _        = False
--      pythagorean_triple :: [Maybe (Int, Int, Int)]  -- List-Maybe Monad
--      pythagorean_triple = filter isJust $
--          [1..10] >-== \x ->
--          [1..10] >-== \y ->
--          [1..10] >-== \z ->
--          guard (x < y && x*x + y*y == z*z) ->~
--          (**:) (x,y,z)
--    in pythagorean_triple
--   :}
--   [Just (3,4,5),Just (6,8,10)]
--   
class (Monad m2) => Monad2 m2 -- | Bind function of level-2. (>>==) :: (Monad2 m2, Monad m1) => m1 (m2 a) -> (a -> m1 (m2 b)) -> m1 (m2 b) -- | Sequence function of level-2. (>>~) :: (Monad m1, Monad2 m2) => m1 (m2 a) -> m1 (m2 b) -> m1 (m2 b) -- | Bind-cover function made of bind >>== and cover -- -*, defined as m >-== k = (-*) m >>== -- k. (>-==) :: (Monad m1, Monad2 m2) => m1 a -> (a -> m1 (m2 b)) -> m1 (m2 b) -- | Bind-cover function made of bind >>== and cover -- *-, defined as m >-== k = (*-) m >>== -- k. (->==) :: (Monad m1, Monad2 m2) => m2 a -> (a -> m1 (m2 b)) -> m1 (m2 b) -- | Sequence-cover function made of sequence >>~ and -- cover -*, defined as m >-~ k = (-*) m >>~ -- k. (>-~) :: (Monad m1, Monad2 m2) => m1 a -> m1 (m2 b) -> m1 (m2 b) -- | Sequence-cover function made of sequence >>~ and -- cover *-, defined as m >-~ k = (*-) m >>~ -- k. (->~) :: (Monad m1, Monad2 m2) => m2 a -> m1 (m2 b) -> m1 (m2 b) -- | Composite function of level-2. (>==>) :: (Monad m1, Monad2 m2) => (a -> m1 (m2 b)) -> (b -> m1 (m2 c)) -> a -> m1 (m2 c) -- | The Monad3 class defines the Monad functions for level-3 types -- m1 (m2 (m3 a). -- --
--   >>> :{
--    let 
--      isJust (Just _) = True
--      isJust _        = False
--      pythagorean_triple :: IO [Maybe (Int, Int, Int)]  -- IO-List-Maybe Monad
--      pythagorean_triple = filter isJust |$> (
--          [1..10] ->-== \x ->
--          [1..10] ->-== \y ->
--          [1..10] ->-== \z ->
--          guard (x < y && x*x + y*y == z*z) -->~
--          print (x,y,z) >--~
--          (***:) (x,y,z)
--        )
--    in pythagorean_triple
--   :}
--   (3,4,5)
--   (6,8,10)
--   [Just (3,4,5),Just (6,8,10)]
--   
class (Monad m3) => Monad3 m3 (>>>==) :: (Monad3 m3, Monad m1, Monad2 m2) => m1 (m2 (m3 a)) -> (a -> m1 (m2 (m3 b))) -> m1 (m2 (m3 b)) (>>-==) :: (Monad m1, Monad2 m2, Monad3 m3) => m1 (m2 a) -> (a -> m1 (m2 (m3 b))) -> m1 (m2 (m3 b)) (->>==) :: (Monad m1, Monad2 m2, Monad3 m3) => m2 (m3 a) -> (a -> m1 (m2 (m3 b))) -> m1 (m2 (m3 b)) (>->==) :: (Monad m1, Monad2 m2, Monad3 m3) => m1 (m3 a) -> (a -> m1 (m2 (m3 b))) -> m1 (m2 (m3 b)) (>--==) :: (Monad m1, Monad2 m2, Monad3 m3) => m1 a -> (a -> m1 (m2 (m3 b))) -> m1 (m2 (m3 b)) (->-==) :: (Monad m1, Monad2 m2, Monad3 m3) => m2 a -> (a -> m1 (m2 (m3 b))) -> m1 (m2 (m3 b)) (-->==) :: (Monad m1, Monad2 m2, Monad3 m3) => m3 a -> (a -> m1 (m2 (m3 b))) -> m1 (m2 (m3 b)) (>>>~) :: (Monad m1, Monad2 m2, Monad3 m3) => m1 (m2 (m3 a)) -> m1 (m2 (m3 b)) -> m1 (m2 (m3 b)) (->-~) :: (Monad m1, Monad2 m2, Monad3 m3) => m2 a -> m1 (m2 (m3 b)) -> m1 (m2 (m3 b)) (-->~) :: (Monad m1, Monad2 m2, Monad3 m3) => m3 a -> m1 (m2 (m3 b)) -> m1 (m2 (m3 b)) (>>-~) :: (Monad m1, Monad2 m2, Monad3 m3) => m1 (m2 a) -> m1 (m2 (m3 b)) -> m1 (m2 (m3 b)) (->>~) :: (Monad m1, Monad2 m2, Monad3 m3) => m2 (m3 a) -> m1 (m2 (m3 b)) -> m1 (m2 (m3 b)) (>->~) :: (Monad m1, Monad2 m2, Monad3 m3) => m1 (m3 a) -> m1 (m2 (m3 b)) -> m1 (m2 (m3 b)) (>--~) :: (Monad m1, Monad2 m2, Monad3 m3) => m1 a -> m1 (m2 (m3 b)) -> m1 (m2 (m3 b)) (>===>) :: (Monad m1, Monad2 m2, Monad3 m3) => (a -> m1 (m2 (m3 b))) -> (b -> m1 (m2 (m3 c))) -> a -> m1 (m2 (m3 c)) class (Monad m4) => Monad4 m4 (>>>>==) :: (Monad4 m4, Monad m1, Monad2 m2, Monad3 m3) => m1 (m2 (m3 (m4 a))) -> (a -> m1 (m2 (m3 (m4 b)))) -> m1 (m2 (m3 (m4 b))) (>>>>~) :: (Monad m1, Monad2 m2, Monad3 m3, Monad4 m4) => m1 (m2 (m3 (m4 a))) -> m1 (m2 (m3 (m4 b))) -> m1 (m2 (m3 (m4 b))) (>====>) :: (Monad m1, Monad2 m2, Monad3 m3, Monad4 m4) => (a -> m1 (m2 (m3 (m4 b)))) -> (b -> m1 (m2 (m3 (m4 c)))) -> a -> m1 (m2 (m3 (m4 c))) class (Monad m5) => Monad5 m5 (>>>>>==) :: (Monad5 m5, Monad m1, Monad2 m2, Monad3 m3, Monad4 m4) => m1 (m2 (m3 (m4 (m5 a)))) -> (a -> m1 (m2 (m3 (m4 (m5 b))))) -> m1 (m2 (m3 (m4 (m5 b)))) (>>>>>~) :: (Monad m1, Monad2 m2, Monad3 m3, Monad4 m4, Monad5 m5) => m1 (m2 (m3 (m4 (m5 a)))) -> m1 (m2 (m3 (m4 (m5 b)))) -> m1 (m2 (m3 (m4 (m5 b)))) (>=====>) :: (Monad m1, Monad2 m2, Monad3 m3, Monad4 m4, Monad5 m5) => (a -> m1 (m2 (m3 (m4 (m5 b))))) -> (b -> m1 (m2 (m3 (m4 (m5 c))))) -> a -> m1 (m2 (m3 (m4 (m5 c)))) instance DeepControl.Monad.Monad2 GHC.Base.Maybe instance DeepControl.Monad.Monad2 [] instance DeepControl.Monad.Monad2 (Data.Either.Either e) instance DeepControl.Monad.Monad3 GHC.Base.Maybe instance DeepControl.Monad.Monad3 [] instance DeepControl.Monad.Monad3 (Data.Either.Either e) instance DeepControl.Monad.Monad4 GHC.Base.Maybe instance DeepControl.Monad.Monad4 [] instance DeepControl.Monad.Monad4 (Data.Either.Either e) instance DeepControl.Monad.Monad5 GHC.Base.Maybe instance DeepControl.Monad.Monad5 [] instance DeepControl.Monad.Monad5 (Data.Either.Either e) -- | This module enables you to program in Monad-Transformer style for more -- deeper level than the usual Control.Monad.Trans module -- expresses. You would realize exactly what more deeper -- level means by reading the example codes, which are attached -- on the page bottom. Note: all the MonadTransx instances for Level-4 -- and Level-5 haven't been written yet. module DeepControl.MonadTrans -- | Monads in which IO computations may be embedded. Any monad -- built by applying a sequence of monad transformers to the IO -- monad will be an instance of this class. -- -- Instances should satisfy the following laws, which state that -- liftIO is a transformer of monads: -- -- class Monad m => MonadIO (m :: * -> *) -- | Lift a computation from the IO monad. liftIO :: MonadIO m => IO a -> m a class MonadTrans t -- | Alias for lift. trans :: (MonadTrans t, Monad m) => m a -> t m a class MonadTrans2 t trans2 :: (MonadTrans2 t, Monad m1, Monad2 m2) => m1 (m2 a) -> t m1 m2 a class MonadTrans3 t trans3 :: (MonadTrans3 t, Monad m1, Monad2 m2, Monad3 m3) => m1 (m2 (m3 a)) -> t m1 m2 m3 a class MonadTrans4 t trans4 :: (MonadTrans4 t, Monad m1, Monad2 m2, Monad3 m3, Monad4 m4) => m1 (m2 (m3 (m4 a))) -> t m1 m2 m3 m4 a class MonadTrans5 t trans5 :: (MonadTrans5 t, Monad m1, Monad2 m2, Monad3 m3, Monad4 m4, Monad5 m5) => m1 (m2 (m3 (m4 (m5 a)))) -> t m1 m2 m3 m4 m5 a -- | This module is made of Traversable, distilling most -- function names polluted with action kind of concepts into -- crystalized(static) ones. Another reason I put this module is for the -- case if GHC would parse ((->) r) as a data constructor -- someday. module DeepControl.Commutative class (Functor c) => Commutative c -- | This method is the same for sequenceA just except the -- name. The only difference is the name "commute", that is to say from -- which no action kind of concepts smell. commute :: (Commutative c, Applicative f) => c (f a) -> f (c a) -- | Do fmap f then commute, the same for -- traverse. cmap :: (Applicative f, Commutative c) => (a -> f b) -> c a -> f (c b) -- | The auguments-flipped function for cmap, the same for -- for. cfor :: (Applicative f, Commutative c) => c a -> (a -> f b) -> f (c b) -- | This function may be used as a value for fmap in a -- Functor instance, provided that commute is defined. -- (Using fmapDefault with a Commutative instance will -- result in infinite recursion.) fmapDefault :: Commutative t => (a -> b) -> t a -> t b -- | This function may be used as a value for foldMap in a -- Foldable instance. foldMapDefault :: (Commutative t, Monoid m) => (a -> m) -> t a -> m instance DeepControl.Commutative.Commutative GHC.Base.Maybe instance DeepControl.Commutative.Commutative [] instance DeepControl.Commutative.Commutative (Data.Either.Either a) instance DeepControl.Commutative.Commutative ((,) a) instance DeepControl.Commutative.Commutative (Control.Applicative.Const m) instance GHC.Base.Functor DeepControl.Commutative.Id instance GHC.Base.Applicative DeepControl.Commutative.Id -- | This module is just a concise mimic for Except Monad in -- mtl(monad-transformer-library). The qualifier "concise" means that -- this module doesn't make no attempt to transform functions of any kind -- of Monad automatically. So when making some new data type of ExceptT, -- you have to manually define involved Monad instances, for example -- MonadReader, MonadWriter or MonadState, by making -- use of the transformation functions such as trans, -- trans2, etc. Admittedly it is tedious though, you can deeply -- understand monad-transformation mechanism instead. module DeepControl.Monad.Except class Error a where noMsg = strMsg "" strMsg _ = noMsg noMsg :: Error a => a strMsg :: Error a => String -> a -- | The strategy of combining computations that can throw exceptions by -- bypassing bound functions from the point an exception is thrown to the -- point that it is handled. -- -- Is parameterized over the type of error information and the monad type -- constructor. It is common to use Either String as the -- monad type constructor for an error monad in which error descriptions -- take the form of strings. In that case and many other common cases the -- resulting monad is already defined as an instance of the -- MonadError class. You can also define your own error type -- and/or use a monad type constructor other than Either -- String or Either IOError. In -- these cases you will have to explicitly define instances of the -- Error and/or MonadError classes. class Monad m => MonadError e (m :: * -> *) | m -> e -- | Is used within a monadic computation to begin exception processing. throwError :: MonadError e m => e -> m a -- | A handler function to handle previous errors and return to normal -- execution. A common idiom is: -- --
--   do { action1; action2; action3 } `catchError` handler
--   
-- -- where the action functions can call throwError. Note -- that handler and the do-block must have the same return type. catchError :: MonadError e m => m a -> (e -> m a) -> m a newtype Except e a Except :: Either e a -> Except e a [runExcept] :: Except e a -> Either e a mapExcept :: (Either e a -> Either e' b) -> Except e a -> Except e' b withExcept :: (e -> e') -> Except e a -> Except e' a newtype ExceptT e m a ExceptT :: m (Either e a) -> ExceptT e m a [runExceptT] :: ExceptT e m a -> m (Either e a) mapExceptT :: (m (Either e a) -> n (Either e' b)) -> ExceptT e m a -> ExceptT e' n b withExceptT :: Functor m => (e -> e') -> ExceptT e m a -> ExceptT e' m a instance Control.Monad.Error.Class.MonadError e (DeepControl.Monad.Except.Except e) instance GHC.Base.Monad (DeepControl.Monad.Except.Except e) instance GHC.Base.Applicative (DeepControl.Monad.Except.Except e) instance GHC.Base.Functor (DeepControl.Monad.Except.Except e) instance (GHC.Show.Show e, GHC.Show.Show a) => GHC.Show.Show (DeepControl.Monad.Except.Except e a) instance DeepControl.Commutative.Commutative (DeepControl.Monad.Except.Except e) instance GHC.Base.Functor m => GHC.Base.Functor (DeepControl.Monad.Except.ExceptT e m) instance GHC.Base.Monad m => GHC.Base.Applicative (DeepControl.Monad.Except.ExceptT e m) instance GHC.Base.Monad m => GHC.Base.Monad (DeepControl.Monad.Except.ExceptT e m) instance (GHC.Base.Monad m, DeepControl.Monad.Except.Error e) => Control.Monad.Error.Class.MonadError e (DeepControl.Monad.Except.ExceptT e m) instance DeepControl.MonadTrans.MonadTrans (DeepControl.Monad.Except.ExceptT e) instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (DeepControl.Monad.Except.ExceptT e m) -- | This module is just a concise mimic for List Monad in -- mtl(monad-transformer-library). The qualifier "concise" means that -- this module doesn't make no attempt to transform functions of any kind -- of Monad automatically. So when making some new data type of ListT, -- you have to manually define involved Monad instances, for example -- MonadReader, MonadWriter or MonadState, by making -- use of the transformation functions such as trans, -- trans2, etc. Admittedly it is tedious though, you can deeply -- understand monad-transformation mechanism instead. module DeepControl.Monad.List newtype ListT m a ListT :: m [a] -> ListT m a [runListT] :: ListT m a -> m [a] mapListT :: (m [a] -> n [b]) -> ListT m a -> ListT n b liftCallCC :: CallCC m [a] [b] -> CallCC (ListT m) a b liftCatch :: Catch e m [a] -> Catch e (ListT m) a instance GHC.Base.Functor m => GHC.Base.Functor (DeepControl.Monad.List.ListT m) instance GHC.Base.Applicative m => GHC.Base.Applicative (DeepControl.Monad.List.ListT m) instance GHC.Base.Monad m => GHC.Base.Monad (DeepControl.Monad.List.ListT m) instance DeepControl.MonadTrans.MonadTrans DeepControl.Monad.List.ListT instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (DeepControl.Monad.List.ListT m) -- | This module is just a concise mimic for Maybe Monad in -- mtl(monad-transformer-library). The qualifier "concise" means that -- this module doesn't make no attempt to transform functions of any kind -- of Monad automatically. So when making some new data type of MaybeT, -- you have to manually define involved Monad instances, for example -- MonadReader, MonadWriter or MonadState, by making -- use of the transformation functions such as trans, -- trans2, etc. Admittedly it is tedious though, you can deeply -- understand monad-transformation mechanism instead. module DeepControl.Monad.Maybe newtype MaybeT m a MaybeT :: m (Maybe a) -> MaybeT m a [runMaybeT] :: MaybeT m a -> m (Maybe a) mapMaybeT :: (m (Maybe a) -> n (Maybe b)) -> MaybeT m a -> MaybeT n b liftCatch :: Catch e m (Maybe a) -> Catch e (MaybeT m) a instance GHC.Base.Functor m => GHC.Base.Functor (DeepControl.Monad.Maybe.MaybeT m) instance GHC.Base.Monad m => GHC.Base.Applicative (DeepControl.Monad.Maybe.MaybeT m) instance GHC.Base.Monad m => GHC.Base.Monad (DeepControl.Monad.Maybe.MaybeT m) instance DeepControl.MonadTrans.MonadTrans DeepControl.Monad.Maybe.MaybeT instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (DeepControl.Monad.Maybe.MaybeT m) -- | This module is just a concise mimic for RWS Monad in -- mtl(monad-transformer-library). The qualifier "concise" means that -- this module doesn't make no attempt to transform functions of any kind -- of Monad automatically. So when making some new data type of RWSTx, -- you have to manually define involved Monad instances, for example -- MonadError, by making use of the transformation functions such -- as trans, trans2, etc. Admittedly it is tedious though, -- you can deeply understand monad-transformation mechanism instead. module DeepControl.Monad.RWS -- | See examples in Control.Monad.Reader. Note, the partially -- applied function type (->) r is a simple reader monad. See -- the instance declaration below. class Monad m => MonadReader r (m :: * -> *) | m -> r -- | Retrieves the monad environment. ask :: MonadReader r m => m r -- | Executes a computation in a modified environment. local :: MonadReader r m => (r -> r) -> m a -> m a -- | Retrieves a function of the current environment. reader :: MonadReader r m => (r -> a) -> m a class (Monoid w, Monad m) => MonadWriter w (m :: * -> *) | m -> w -- | writer (a,w) embeds a simple writer action. writer :: MonadWriter w m => (a, w) -> m a -- | tell w is an action that produces the output -- w. tell :: MonadWriter w m => w -> m () -- | listen m is an action that executes the action -- m and adds its output to the value of the computation. listen :: MonadWriter w m => m a -> m (a, w) -- | pass m is an action that executes the action -- m, which returns a value and a function, and returns the -- value, applying the function to the output. pass :: MonadWriter w m => m (a, w -> w) -> m a -- | Minimal definition is either both of get and put or -- just state class Monad m => MonadState s (m :: * -> *) | m -> s -- | Return the state from the internals of the monad. get :: MonadState s m => m s -- | Replace the state inside the monad. put :: MonadState s m => s -> m () -- | Embed a simple state action into the monad. state :: MonadState s m => (s -> (a, s)) -> m a newtype RWS r w s a RWS :: (r -> s -> (a, s, w)) -> RWS r w s a [runRWS] :: RWS r w s a -> r -> s -> (a, s, w) rws :: (r -> s -> (a, s, w)) -> RWS r w s a evalRWS :: RWS r w s a -> r -> s -> (a, w) execRWS :: RWS r w s a -> r -> s -> (s, w) mapRWS :: ((a, s, w) -> (b, s, w')) -> RWS r w s a -> RWS r w' s b withRWS :: (r' -> s -> (r, s)) -> RWS r w s a -> RWS r' w s a newtype RWST r w s m a RWST :: (r -> s -> m (a, s, w)) -> RWST r w s m a [runRWST] :: RWST r w s m a -> r -> s -> m (a, s, w) rwsT :: (Monad m) => (r -> s -> (a, s, w)) -> RWST r w s m a evalRWST :: (Monad m) => RWST r w s m a -> r -> s -> m (a, w) execRWST :: (Monad m) => RWST r w s m a -> r -> s -> m (s, w) mapRWST :: (m (a, s, w) -> n (b, s, w')) -> RWST r w s m a -> RWST r w' s n b withRWST :: (r' -> s -> (r, s)) -> RWST r w s m a -> RWST r' w s m a liftCatch :: Catch e m (a, s, w) -> Catch e (RWST r w s m) a newtype RWST2 r w s m1 m2 a RWST2 :: (r -> s -> m1 (m2 (a, s, w))) -> RWST2 r w s m1 m2 a [runRWST2] :: RWST2 r w s m1 m2 a -> r -> s -> m1 (m2 (a, s, w)) rwsT2 :: (Monad m1, Monad2 m2) => (r -> s -> (a, s, w)) -> RWST2 r w s m1 m2 a evalRWST2 :: (Monad m1, Monad2 m2) => RWST2 r w s m1 m2 a -> r -> s -> m1 (m2 (a, w)) execRWST2 :: (Monad m1, Monad2 m2) => RWST2 r w s m1 m2 a -> r -> s -> m1 (m2 (s, w)) mapRWST2 :: (m1 (m2 (a, s, w)) -> n1 (n2 (b, s, w'))) -> RWST2 r w s m1 m2 a -> RWST2 r w' s n1 n2 b withRWST2 :: (r' -> s -> (r, s)) -> RWST2 r w s m1 m2 a -> RWST2 r' w s m1 m2 a newtype RWST3 r w s m1 m2 m3 a RWST3 :: (r -> s -> m1 (m2 (m3 (a, s, w)))) -> RWST3 r w s m1 m2 m3 a [runRWST3] :: RWST3 r w s m1 m2 m3 a -> r -> s -> m1 (m2 (m3 (a, s, w))) rwsT3 :: (Monad m1, Monad2 m2, Monad3 m3) => (r -> s -> (a, s, w)) -> RWST3 r w s m1 m2 m3 a evalRWST3 :: (Monad m1, Monad2 m2, Monad3 m3) => RWST3 r w s m1 m2 m3 a -> r -> s -> m1 (m2 (m3 (a, w))) execRWST3 :: (Monad m1, Monad2 m2, Monad3 m3) => RWST3 r w s m1 m2 m3 a -> r -> s -> m1 (m2 (m3 (s, w))) mapRWST3 :: (m1 (m2 (m3 (a, s, w))) -> n1 (n2 (n3 (b, s, w')))) -> RWST3 r w s m1 m2 m3 a -> RWST3 r w' s n1 n2 n3 b withRWST3 :: (r' -> s -> (r, s)) -> RWST3 r w s m1 m2 m3 a -> RWST3 r' w s m1 m2 m3 a instance GHC.Base.Functor (DeepControl.Monad.RWS.RWS r w s) instance GHC.Base.Monoid w => GHC.Base.Applicative (DeepControl.Monad.RWS.RWS r w s) instance GHC.Base.Monoid w => GHC.Base.Monad (DeepControl.Monad.RWS.RWS r w s) instance GHC.Base.Monoid w => Control.Monad.Reader.Class.MonadReader r (DeepControl.Monad.RWS.RWS r w s) instance GHC.Base.Monoid w => Control.Monad.Writer.Class.MonadWriter w (DeepControl.Monad.RWS.RWS r w s) instance GHC.Base.Monoid w => Control.Monad.State.Class.MonadState s (DeepControl.Monad.RWS.RWS r w s) instance GHC.Base.Functor m => GHC.Base.Functor (DeepControl.Monad.RWS.RWST r w s m) instance (GHC.Base.Monoid w, GHC.Base.Monad m) => GHC.Base.Applicative (DeepControl.Monad.RWS.RWST r w s m) instance (GHC.Base.Monoid w, GHC.Base.Monad m) => GHC.Base.Monad (DeepControl.Monad.RWS.RWST r w s m) instance (GHC.Base.Monoid w, GHC.Base.Monad m) => Control.Monad.Reader.Class.MonadReader r (DeepControl.Monad.RWS.RWST r w s m) instance (GHC.Base.Monoid w, GHC.Base.Monad m) => Control.Monad.Writer.Class.MonadWriter w (DeepControl.Monad.RWS.RWST r w s m) instance (GHC.Base.Monoid w, GHC.Base.Monad m) => Control.Monad.State.Class.MonadState s (DeepControl.Monad.RWS.RWST r w s m) instance GHC.Base.Monoid w => DeepControl.MonadTrans.MonadTrans (DeepControl.Monad.RWS.RWST r w s) instance (GHC.Base.Monoid w, Control.Monad.IO.Class.MonadIO m, GHC.Base.Monad m) => Control.Monad.IO.Class.MonadIO (DeepControl.Monad.RWS.RWST r w s m) instance (GHC.Base.Functor m1, GHC.Base.Functor m2) => GHC.Base.Functor (DeepControl.Monad.RWS.RWST2 r w s m1 m2) instance (GHC.Base.Monoid w, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2) => GHC.Base.Applicative (DeepControl.Monad.RWS.RWST2 r w s m1 m2) instance (GHC.Base.Monoid w, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2) => GHC.Base.Monad (DeepControl.Monad.RWS.RWST2 r w s m1 m2) instance (GHC.Base.Monoid w, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2) => Control.Monad.Reader.Class.MonadReader r (DeepControl.Monad.RWS.RWST2 r w s m1 m2) instance (GHC.Base.Monoid w, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2) => Control.Monad.Writer.Class.MonadWriter w (DeepControl.Monad.RWS.RWST2 r w s m1 m2) instance (GHC.Base.Monoid w, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2) => Control.Monad.State.Class.MonadState s (DeepControl.Monad.RWS.RWST2 r w s m1 m2) instance GHC.Base.Monoid w => DeepControl.MonadTrans.MonadTrans2 (DeepControl.Monad.RWS.RWST2 r w s) instance (GHC.Base.Monoid w, Control.Monad.IO.Class.MonadIO m1, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2) => Control.Monad.IO.Class.MonadIO (DeepControl.Monad.RWS.RWST2 r w s m1 m2) instance (GHC.Base.Functor m1, GHC.Base.Functor m2, GHC.Base.Functor m3) => GHC.Base.Functor (DeepControl.Monad.RWS.RWST3 r w s m1 m2 m3) instance (GHC.Base.Monoid w, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2, DeepControl.Monad.Monad3 m3) => GHC.Base.Applicative (DeepControl.Monad.RWS.RWST3 r w s m1 m2 m3) instance (GHC.Base.Monoid w, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2, DeepControl.Monad.Monad3 m3) => GHC.Base.Monad (DeepControl.Monad.RWS.RWST3 r w s m1 m2 m3) instance (GHC.Base.Monoid w, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2, DeepControl.Monad.Monad3 m3) => Control.Monad.Reader.Class.MonadReader r (DeepControl.Monad.RWS.RWST3 r w s m1 m2 m3) instance (GHC.Base.Monoid w, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2, DeepControl.Monad.Monad3 m3) => Control.Monad.Writer.Class.MonadWriter w (DeepControl.Monad.RWS.RWST3 r w s m1 m2 m3) instance (GHC.Base.Monoid w, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2, DeepControl.Monad.Monad3 m3) => Control.Monad.State.Class.MonadState s (DeepControl.Monad.RWS.RWST3 r w s m1 m2 m3) instance GHC.Base.Monoid w => DeepControl.MonadTrans.MonadTrans3 (DeepControl.Monad.RWS.RWST3 r w s) instance (GHC.Base.Monoid w, Control.Monad.IO.Class.MonadIO m1, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2, DeepControl.Monad.Monad3 m3) => Control.Monad.IO.Class.MonadIO (DeepControl.Monad.RWS.RWST3 r w s m1 m2 m3) -- | This module is just a concise mimic for Reader Monad in -- mtl(monad-transformer-library). The qualifier "concise" means that -- this module doesn't make no attempt to transform functions of any kind -- of Monad automatically. So when making some new data type of ReaderT, -- you have to manually define involved Monad instances, for example -- MonadError, by making use of the transformation functions such -- as trans, trans2, etc. Admittedly it is tedious though, -- you can deeply understand monad-transformation mechanism instead. module DeepControl.Monad.Reader -- | See examples in Control.Monad.Reader. Note, the partially -- applied function type (->) r is a simple reader monad. See -- the instance declaration below. class Monad m => MonadReader r (m :: * -> *) | m -> r -- | Retrieves the monad environment. ask :: MonadReader r m => m r -- | Executes a computation in a modified environment. local :: MonadReader r m => (r -> r) -> m a -> m a -- | Retrieves a function of the current environment. reader :: MonadReader r m => (r -> a) -> m a asks :: MonadReader r m => (r -> a) -> m a newtype Reader r a Reader :: (r -> a) -> Reader r a [runReader] :: Reader r a -> r -> a newtype ReaderT r m a ReaderT :: (r -> m a) -> ReaderT r m a [runReaderT] :: ReaderT r m a -> r -> m a mapReaderT :: (m a -> n b) -> ReaderT r m a -> ReaderT r n b liftCatch :: Catch e m a -> Catch e (ReaderT r m) a newtype ReaderT2 r m1 m2 a ReaderT2 :: (r -> m1 (m2 a)) -> ReaderT2 r m1 m2 a [runReaderT2] :: ReaderT2 r m1 m2 a -> r -> m1 (m2 a) mapReaderT2 :: (m1 (m2 a) -> n1 (n2 b)) -> ReaderT2 r m1 m2 a -> ReaderT2 r n1 n2 b newtype ReaderT3 r m1 m2 m3 a ReaderT3 :: (r -> m1 (m2 (m3 a))) -> ReaderT3 r m1 m2 m3 a [runReaderT3] :: ReaderT3 r m1 m2 m3 a -> r -> m1 (m2 (m3 a)) mapReaderT3 :: (m1 (m2 (m3 a)) -> n1 (n2 (n3 b))) -> ReaderT3 r m1 m2 m3 a -> ReaderT3 r n1 n2 n3 b instance GHC.Base.Functor (DeepControl.Monad.Reader.Reader r) instance GHC.Base.Applicative (DeepControl.Monad.Reader.Reader r) instance GHC.Base.Monad (DeepControl.Monad.Reader.Reader r) instance Control.Monad.Reader.Class.MonadReader r (DeepControl.Monad.Reader.Reader r) instance GHC.Base.Functor m => GHC.Base.Functor (DeepControl.Monad.Reader.ReaderT r m) instance GHC.Base.Monad m => GHC.Base.Applicative (DeepControl.Monad.Reader.ReaderT s m) instance GHC.Base.Monad m => GHC.Base.Monad (DeepControl.Monad.Reader.ReaderT r m) instance GHC.Base.Monad m => Control.Monad.Reader.Class.MonadReader r (DeepControl.Monad.Reader.ReaderT r m) instance DeepControl.MonadTrans.MonadTrans (DeepControl.Monad.Reader.ReaderT r) instance (Control.Monad.IO.Class.MonadIO m, GHC.Base.Monad m) => Control.Monad.IO.Class.MonadIO (DeepControl.Monad.Reader.ReaderT r m) instance (GHC.Base.Functor m1, GHC.Base.Functor m2) => GHC.Base.Functor (DeepControl.Monad.Reader.ReaderT2 r m1 m2) instance (GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2) => GHC.Base.Applicative (DeepControl.Monad.Reader.ReaderT2 s m1 m2) instance (GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2) => GHC.Base.Monad (DeepControl.Monad.Reader.ReaderT2 r m1 m2) instance (GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2) => Control.Monad.Reader.Class.MonadReader r (DeepControl.Monad.Reader.ReaderT2 r m1 m2) instance DeepControl.MonadTrans.MonadTrans2 (DeepControl.Monad.Reader.ReaderT2 r) instance (Control.Monad.IO.Class.MonadIO m1, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2) => Control.Monad.IO.Class.MonadIO (DeepControl.Monad.Reader.ReaderT2 r m1 m2) instance (GHC.Base.Functor m1, GHC.Base.Functor m2, GHC.Base.Functor m3) => GHC.Base.Functor (DeepControl.Monad.Reader.ReaderT3 r m1 m2 m3) instance (GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2, DeepControl.Monad.Monad3 m3) => GHC.Base.Applicative (DeepControl.Monad.Reader.ReaderT3 s m1 m2 m3) instance (GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2, DeepControl.Monad.Monad3 m3) => GHC.Base.Monad (DeepControl.Monad.Reader.ReaderT3 r m1 m2 m3) instance (GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2, DeepControl.Monad.Monad3 m3) => Control.Monad.Reader.Class.MonadReader r (DeepControl.Monad.Reader.ReaderT3 r m1 m2 m3) instance DeepControl.MonadTrans.MonadTrans3 (DeepControl.Monad.Reader.ReaderT3 r) instance (Control.Monad.IO.Class.MonadIO m1, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2, DeepControl.Monad.Monad3 m3) => Control.Monad.IO.Class.MonadIO (DeepControl.Monad.Reader.ReaderT3 r m1 m2 m3) -- | This module is just a concise mimic for State Monad in -- mtl(monad-transformer-library). The qualifier "concise" means that -- this module doesn't make no attempt to transform functions of any kind -- of Monad automatically. So when making some new data type of StateT, -- you have to manually define involved Monad instances, for example -- MonadError, by making use of the transformation functions such -- as trans, trans2, etc. Admittedly it is tedious though, -- you can deeply understand monad-transformation mechanism instead. module DeepControl.Monad.State -- | Minimal definition is either both of get and put or -- just state class Monad m => MonadState s (m :: * -> *) | m -> s -- | Return the state from the internals of the monad. get :: MonadState s m => m s -- | Replace the state inside the monad. put :: MonadState s m => s -> m () -- | Embed a simple state action into the monad. state :: MonadState s m => (s -> (a, s)) -> m a modify :: MonadState s m => (s -> s) -> m () gets :: MonadState s m => (s -> a) -> m a newtype State s a State :: (s -> (a, s)) -> State s a [runState] :: State s a -> s -> (a, s) evalState :: State s a -> s -> a execState :: State s a -> s -> s mapState :: ((a, s) -> (b, s)) -> State s a -> State s b withState :: (s -> s) -> State s a -> State s a newtype StateT s m a StateT :: (s -> m (a, s)) -> StateT s m a [runStateT] :: StateT s m a -> (s -> m (a, s)) evalStateT :: (Monad m) => StateT s m a -> s -> m a execStateT :: (Monad m) => StateT s m a -> s -> m s mapStateT :: (m (a, s) -> n (b, s)) -> StateT s m a -> StateT s n b withStateT :: (s -> s) -> StateT s m a -> StateT s m a liftCatch :: Catch e m (a, s) -> Catch e (StateT s m) a newtype StateT2 s m1 m2 a StateT2 :: (s -> m1 (m2 (a, s))) -> StateT2 s m1 m2 a [runStateT2] :: StateT2 s m1 m2 a -> (s -> m1 (m2 (a, s))) evalStateT2 :: (Monad m1, Monad2 m2) => StateT2 s m1 m2 a -> s -> m1 (m2 a) execStateT2 :: (Monad m1, Monad2 m2) => StateT2 s m1 m2 a -> s -> m1 (m2 s) mapStateT2 :: (m1 (m2 (a, s)) -> n1 (n2 (b, s))) -> StateT2 s m1 m2 a -> StateT2 s n1 n2 b withStateT2 :: (s -> s) -> StateT2 s m1 m2 a -> StateT2 s m1 m2 a newtype StateT3 s m1 m2 m3 a StateT3 :: (s -> m1 (m2 (m3 (a, s)))) -> StateT3 s m1 m2 m3 a [runStateT3] :: StateT3 s m1 m2 m3 a -> (s -> m1 (m2 (m3 (a, s)))) evalStateT3 :: (Monad m1, Monad2 m2, Monad3 m3) => StateT3 s m1 m2 m3 a -> s -> m1 (m2 (m3 a)) execStateT3 :: (Monad m1, Monad2 m2, Monad3 m3) => StateT3 s m1 m2 m3 a -> s -> m1 (m2 (m3 s)) mapStateT3 :: (m1 (m2 (m3 (a, s))) -> n1 (n2 (n3 (b, s)))) -> StateT3 s m1 m2 m3 a -> StateT3 s n1 n2 n3 b withStateT3 :: (s -> s) -> StateT3 s m1 m2 m3 a -> StateT3 s m1 m2 m3 a instance GHC.Base.Functor (DeepControl.Monad.State.State s) instance GHC.Base.Applicative (DeepControl.Monad.State.State s) instance GHC.Base.Monad (DeepControl.Monad.State.State s) instance Control.Monad.State.Class.MonadState s (DeepControl.Monad.State.State s) instance GHC.Base.Functor m => GHC.Base.Functor (DeepControl.Monad.State.StateT s m) instance GHC.Base.Monad m => GHC.Base.Applicative (DeepControl.Monad.State.StateT s m) instance GHC.Base.Monad m => GHC.Base.Monad (DeepControl.Monad.State.StateT s m) instance GHC.Base.Monad m => Control.Monad.State.Class.MonadState s (DeepControl.Monad.State.StateT s m) instance DeepControl.MonadTrans.MonadTrans (DeepControl.Monad.State.StateT s) instance (Control.Monad.IO.Class.MonadIO m, GHC.Base.Monad m) => Control.Monad.IO.Class.MonadIO (DeepControl.Monad.State.StateT s m) instance (GHC.Base.Functor m1, GHC.Base.Functor m2) => GHC.Base.Functor (DeepControl.Monad.State.StateT2 s m1 m2) instance (GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2) => GHC.Base.Applicative (DeepControl.Monad.State.StateT2 s m1 m2) instance (GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2) => GHC.Base.Monad (DeepControl.Monad.State.StateT2 s m1 m2) instance (GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2) => Control.Monad.State.Class.MonadState s (DeepControl.Monad.State.StateT2 s m1 m2) instance DeepControl.MonadTrans.MonadTrans2 (DeepControl.Monad.State.StateT2 s) instance (Control.Monad.IO.Class.MonadIO m1, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2) => Control.Monad.IO.Class.MonadIO (DeepControl.Monad.State.StateT2 s m1 m2) instance (GHC.Base.Functor m1, GHC.Base.Functor m2, GHC.Base.Functor m3) => GHC.Base.Functor (DeepControl.Monad.State.StateT3 s m1 m2 m3) instance (GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2, DeepControl.Monad.Monad3 m3) => GHC.Base.Applicative (DeepControl.Monad.State.StateT3 s m1 m2 m3) instance (GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2, DeepControl.Monad.Monad3 m3) => GHC.Base.Monad (DeepControl.Monad.State.StateT3 s m1 m2 m3) instance (GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2, DeepControl.Monad.Monad3 m3) => Control.Monad.State.Class.MonadState s (DeepControl.Monad.State.StateT3 s m1 m2 m3) instance DeepControl.MonadTrans.MonadTrans3 (DeepControl.Monad.State.StateT3 s) instance (Control.Monad.IO.Class.MonadIO m1, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2, DeepControl.Monad.Monad3 m3) => Control.Monad.IO.Class.MonadIO (DeepControl.Monad.State.StateT3 s m1 m2 m3) -- | This module is just a concise mimic for Reader Monad in -- mtl(monad-transformer-library). The qualifier "concise" means that -- this module doesn't make no attempt to transform functions of any kind -- of Monad automatically. So when making some new data type of WriterT, -- you have to manually define involved Monad instances, for example -- MonadError, by making use of the transformation functions such -- as trans, trans2, etc. Admittedly it is tedious though, -- you can deeply understand monad-transformation mechanism instead. module DeepControl.Monad.Writer class (Monoid w, Monad m) => MonadWriter w (m :: * -> *) | m -> w -- | writer (a,w) embeds a simple writer action. writer :: MonadWriter w m => (a, w) -> m a -- | tell w is an action that produces the output -- w. tell :: MonadWriter w m => w -> m () -- | listen m is an action that executes the action -- m and adds its output to the value of the computation. listen :: MonadWriter w m => m a -> m (a, w) -- | pass m is an action that executes the action -- m, which returns a value and a function, and returns the -- value, applying the function to the output. pass :: MonadWriter w m => m (a, w -> w) -> m a listens :: MonadWriter w m => (w -> b) -> m a -> m (a, b) censor :: MonadWriter w m => (w -> w) -> m a -> m a newtype Writer w a Writer :: (a, w) -> Writer w a [runWriter] :: Writer w a -> (a, w) execWriter :: Writer w a -> w mapWriter :: ((a, w) -> (b, w')) -> Writer w a -> Writer w' b newtype WriterT w m a WriterT :: m (a, w) -> WriterT w m a [runWriterT] :: WriterT w m a -> m (a, w) execWriterT :: (Monad m) => WriterT w m a -> m w mapWriterT :: (m (a, w) -> n (b, w')) -> WriterT w m a -> WriterT w' n b liftCatch :: Catch e m (a, w) -> Catch e (WriterT w m) a newtype WriterT2 w m1 m2 a WriterT2 :: m1 (m2 (a, w)) -> WriterT2 w m1 m2 a [runWriterT2] :: WriterT2 w m1 m2 a -> m1 (m2 (a, w)) execWriterT2 :: (Monad m1, Monad2 m2) => WriterT2 w m1 m2 a -> m1 (m2 w) mapWriterT2 :: (m1 (m2 (a, w)) -> n1 (n2 (b, w'))) -> WriterT2 w m1 m2 a -> WriterT2 w' n1 n2 b newtype WriterT3 w m1 m2 m3 a WriterT3 :: m1 (m2 (m3 (a, w))) -> WriterT3 w m1 m2 m3 a [runWriterT3] :: WriterT3 w m1 m2 m3 a -> m1 (m2 (m3 (a, w))) execWriterT3 :: (Monad m1, Monad2 m2, Monad3 m3) => WriterT3 w m1 m2 m3 a -> m1 (m2 (m3 w)) mapWriterT3 :: (m1 (m2 (m3 (a, w))) -> n1 (n2 (n3 (b, w')))) -> WriterT3 w m1 m2 m3 a -> WriterT3 w' n1 n2 n3 b instance GHC.Base.Functor (DeepControl.Monad.Writer.Writer w) instance GHC.Base.Monoid w => GHC.Base.Applicative (DeepControl.Monad.Writer.Writer w) instance GHC.Base.Monoid w => GHC.Base.Monad (DeepControl.Monad.Writer.Writer w) instance GHC.Base.Monoid w => DeepControl.Monad.Monad2 (DeepControl.Monad.Writer.Writer w) instance GHC.Base.Monoid w => DeepControl.Monad.Monad3 (DeepControl.Monad.Writer.Writer w) instance GHC.Base.Monoid w => DeepControl.Monad.Monad4 (DeepControl.Monad.Writer.Writer w) instance GHC.Base.Monoid w => DeepControl.Monad.Monad5 (DeepControl.Monad.Writer.Writer w) instance GHC.Base.Monoid w => Control.Monad.Writer.Class.MonadWriter w (DeepControl.Monad.Writer.Writer w) instance GHC.Base.Monad m => GHC.Base.Functor (DeepControl.Monad.Writer.WriterT w m) instance (GHC.Base.Monoid w, GHC.Base.Monad m) => GHC.Base.Applicative (DeepControl.Monad.Writer.WriterT w m) instance (GHC.Base.Monoid w, GHC.Base.Monad m) => GHC.Base.Monad (DeepControl.Monad.Writer.WriterT w m) instance (GHC.Base.Monoid w, GHC.Base.Monad m) => Control.Monad.Writer.Class.MonadWriter w (DeepControl.Monad.Writer.WriterT w m) instance GHC.Base.Monoid w => DeepControl.MonadTrans.MonadTrans (DeepControl.Monad.Writer.WriterT w) instance (GHC.Base.Monoid w, Control.Monad.IO.Class.MonadIO m, GHC.Base.Monad m) => Control.Monad.IO.Class.MonadIO (DeepControl.Monad.Writer.WriterT w m) instance (GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2) => GHC.Base.Functor (DeepControl.Monad.Writer.WriterT2 w m1 m2) instance (GHC.Base.Monoid w, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2) => GHC.Base.Applicative (DeepControl.Monad.Writer.WriterT2 w m1 m2) instance (GHC.Base.Monoid w, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2) => GHC.Base.Monad (DeepControl.Monad.Writer.WriterT2 w m1 m2) instance (GHC.Base.Monoid w, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2) => Control.Monad.Writer.Class.MonadWriter w (DeepControl.Monad.Writer.WriterT2 w m1 m2) instance GHC.Base.Monoid w => DeepControl.MonadTrans.MonadTrans2 (DeepControl.Monad.Writer.WriterT2 w) instance (GHC.Base.Monoid w, Control.Monad.IO.Class.MonadIO m1, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2) => Control.Monad.IO.Class.MonadIO (DeepControl.Monad.Writer.WriterT2 w m1 m2) instance (GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2, DeepControl.Monad.Monad3 m3) => GHC.Base.Functor (DeepControl.Monad.Writer.WriterT3 w m1 m2 m3) instance (GHC.Base.Monoid w, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2, DeepControl.Monad.Monad3 m3) => GHC.Base.Applicative (DeepControl.Monad.Writer.WriterT3 w m1 m2 m3) instance (GHC.Base.Monoid w, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2, DeepControl.Monad.Monad3 m3) => GHC.Base.Monad (DeepControl.Monad.Writer.WriterT3 w m1 m2 m3) instance (GHC.Base.Monoid w, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2, DeepControl.Monad.Monad3 m3) => Control.Monad.Writer.Class.MonadWriter w (DeepControl.Monad.Writer.WriterT3 w m1 m2 m3) instance GHC.Base.Monoid w => DeepControl.MonadTrans.MonadTrans3 (DeepControl.Monad.Writer.WriterT3 w) instance (GHC.Base.Monoid w, Control.Monad.IO.Class.MonadIO m1, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2, DeepControl.Monad.Monad3 m3) => Control.Monad.IO.Class.MonadIO (DeepControl.Monad.Writer.WriterT3 w m1 m2 m3) module DeepControl.Arrow newtype Kleisli2 m1 m2 a b Kleisli2 :: (a -> m1 (m2 b)) -> Kleisli2 m1 m2 a b [runKleisli2] :: Kleisli2 m1 m2 a b -> a -> m1 (m2 b) newtype Kleisli3 m1 m2 m3 a b Kleisli3 :: (a -> m1 (m2 (m3 b))) -> Kleisli3 m1 m2 m3 a b [runKleisli3] :: Kleisli3 m1 m2 m3 a b -> a -> m1 (m2 (m3 b)) newtype Kleisli4 m1 m2 m3 m4 a b Kleisli4 :: (a -> m1 (m2 (m3 (m4 b)))) -> Kleisli4 m1 m2 m3 m4 a b [runKleisli4] :: Kleisli4 m1 m2 m3 m4 a b -> a -> m1 (m2 (m3 (m4 b))) newtype Kleisli5 m1 m2 m3 m4 m5 a b Kleisli5 :: (a -> m1 (m2 (m3 (m4 (m5 b))))) -> Kleisli5 m1 m2 m3 m4 m5 a b [runKleisli5] :: Kleisli5 m1 m2 m3 m4 m5 a b -> a -> m1 (m2 (m3 (m4 (m5 b)))) instance (GHC.Base.Applicative m1, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2) => Control.Category.Category (DeepControl.Arrow.Kleisli2 m1 m2) instance (GHC.Base.Applicative m1, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2) => Control.Arrow.Arrow (DeepControl.Arrow.Kleisli2 m1 m2) instance (GHC.Base.Applicative m1, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2, DeepControl.Monad.Monad3 m3) => Control.Category.Category (DeepControl.Arrow.Kleisli3 m1 m2 m3) instance (GHC.Base.Applicative m1, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2, DeepControl.Monad.Monad3 m3) => Control.Arrow.Arrow (DeepControl.Arrow.Kleisli3 m1 m2 m3) instance (GHC.Base.Applicative m1, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2, DeepControl.Monad.Monad3 m3, DeepControl.Monad.Monad4 m4) => Control.Category.Category (DeepControl.Arrow.Kleisli4 m1 m2 m3 m4) instance (GHC.Base.Applicative m1, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2, DeepControl.Monad.Monad3 m3, DeepControl.Monad.Monad4 m4) => Control.Arrow.Arrow (DeepControl.Arrow.Kleisli4 m1 m2 m3 m4) instance (GHC.Base.Applicative m1, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2, DeepControl.Monad.Monad3 m3, DeepControl.Monad.Monad4 m4, DeepControl.Monad.Monad5 m5) => Control.Category.Category (DeepControl.Arrow.Kleisli5 m1 m2 m3 m4 m5) instance (GHC.Base.Applicative m1, GHC.Base.Monad m1, DeepControl.Monad.Monad2 m2, DeepControl.Monad.Monad3 m3, DeepControl.Monad.Monad4 m4, DeepControl.Monad.Monad5 m5) => Control.Arrow.Arrow (DeepControl.Arrow.Kleisli5 m1 m2 m3 m4 m5)