-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Enable deeper level style of programming than the usual control provides -- -- This module enables deeper level style of programming than the usual -- control provides, especially for Applicative and Monad. @package deepcontrol @version 0.1.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 braket-cover notation for -- Level-4 and Level-5 is not 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 auguments-flipped function for |*>>. (<<*|) :: (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] --(*-|) :: (Applicative f1, Applicative f2) => f2 a -> f1 (f2 (a -> b)) -> 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, 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, 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)))) -- | 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: -- --
-- >>> 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 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.
commuteMap :: (Applicative f, Commutative c) => (a -> f b) -> c a -> f (c b)
-- | The auguments-flipped function for commuteMap, the
-- same for for.
commuteFor :: (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
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)
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)
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
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)
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
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)
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
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)
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)