-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | A small compatibility shim for the transformers library
--   
--   This package includes backported versions of types that were added to
--   transformers in transformers 0.3, 0.4, and 0.5 for users who need
--   strict transformers 0.2 or 0.3 compatibility to run on old versions of
--   the platform, but also need those types.
--   
--   Those users should be able to just depend on <tt>transformers &gt;=
--   0.2</tt> and <tt>transformers-compat &gt;= 0.3</tt>.
--   
--   Note: missing methods are not supplied, but this at least permits the
--   types to be used.
@package transformers-compat
@version 0.6.2


-- | Internal functionality for <a>Data.Functor.Classes.Generic</a>.
--   
--   This is an internal module and, as such, the API is not guaranteed to
--   remain the same between any given release.
module Data.Functor.Classes.Generic.Internal

-- | Options that further configure how the functions in
--   <a>Data.Functor.Classes.Generic</a> should behave.
newtype Options
Options :: Bool -> Options

-- | If <a>True</a>, a default <a>Show1</a> implementation will show hash
--   signs (<tt>#</tt>) when showing unlifted types.
[ghc8ShowBehavior] :: Options -> Bool

-- | Options that match the behavior of the installed version of GHC.
defaultOptions :: Options

-- | Options that match the behavior of the most recent GHC release.
latestGHCOptions :: Options

-- | A sensible default <a>liftEq</a> implementation for <a>Generic1</a>
--   instances.
liftEqDefault :: (GEq1 NonV4 (Rep1 f), Generic1 f) => (a -> b -> Bool) -> f a -> f b -> Bool

-- | Like <a>liftEqDefault</a>, but with configurable <a>Options</a>.
--   Currently, the <a>Options</a> have no effect (but this may change in
--   the future).
liftEqOptions :: (GEq1 NonV4 (Rep1 f), Generic1 f) => Options -> (a -> b -> Bool) -> f a -> f b -> Bool

-- | Class of generic representation types that can be checked for
--   equality.
class GEq1 v t
gliftEq :: GEq1 v t => Eq1Args v a b -> t a -> t b -> Bool

-- | An <a>Eq1Args</a> value either stores an <tt>Eq a</tt> dictionary (for
--   the <tt>transformers-0.4</tt> version of <a>Eq1</a>), or it stores the
--   function argument that checks the equality of occurrences of the type
--   parameter (for the non-<tt>transformers-0.4</tt> version of
--   <a>Eq1</a>).
data Eq1Args v a b
[V4Eq1Args] :: Eq a => Eq1Args V4 a a
[NonV4Eq1Args] :: (a -> b -> Bool) -> Eq1Args NonV4 a b

-- | A sensible default <a>liftCompare</a> implementation for
--   <a>Generic1</a> instances.
liftCompareDefault :: (GOrd1 NonV4 (Rep1 f), Generic1 f) => (a -> b -> Ordering) -> f a -> f b -> Ordering

-- | Like <a>liftCompareDefault</a>, but with configurable <a>Options</a>.
--   Currently, the <a>Options</a> have no effect (but this may change in
--   the future).
liftCompareOptions :: (GOrd1 NonV4 (Rep1 f), Generic1 f) => Options -> (a -> b -> Ordering) -> f a -> f b -> Ordering

-- | Class of generic representation types that can be totally ordered.
class GEq1 v t => GOrd1 v t
gliftCompare :: GOrd1 v t => Ord1Args v a b -> t a -> t b -> Ordering

-- | An <a>Ord1Args</a> value either stores an <tt>Ord a</tt> dictionary
--   (for the <tt>transformers-0.4</tt> version of <a>Ord1</a>), or it
--   stores the function argument that compares occurrences of the type
--   parameter (for the non-<tt>transformers-0.4</tt> version of
--   <a>Ord1</a>).
data Ord1Args v a b
[V4Ord1Args] :: Ord a => Ord1Args V4 a a
[NonV4Ord1Args] :: (a -> b -> Ordering) -> Ord1Args NonV4 a b

-- | A sensible default <a>liftReadsPrec</a> implementation for
--   <a>Generic1</a> instances.
liftReadsPrecDefault :: (GRead1 NonV4 (Rep1 f), Generic1 f) => (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (f a)

-- | Like <a>liftReadsPrecDefault</a>, but with configurable
--   <a>Options</a>. Currently, the <a>Options</a> have no effect (but this
--   may change in the future).
liftReadsPrecOptions :: (GRead1 NonV4 (Rep1 f), Generic1 f) => Options -> (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (f a)

-- | Class of generic representation types that can be parsed from a
--   <a>String</a>.
class GRead1 v f
gliftReadPrec :: GRead1 v f => Read1Args v a -> ReadPrec (f a)

-- | Class of generic representation types that can be parsed from a
--   <a>String</a>, and for which the <a>ConType</a> has been determined.
class GRead1Con v f
gliftReadPrecCon :: GRead1Con v f => ConType -> Read1Args v a -> ReadPrec (f a)

-- | A <a>Read1Args</a> value either stores a <tt>Read a</tt> dictionary
--   (for the <tt>transformers-0.4</tt> version of <a>Read1</a>), or it
--   stores the two function arguments that parse occurrences of the type
--   parameter (for the non-<tt>transformers-0.4</tt> version of
--   <a>Read1</a>).
data Read1Args v a
[V4Read1Args] :: Read a => Read1Args V4 a
[NonV4Read1Args] :: ReadPrec a -> ReadPrec [a] -> Read1Args NonV4 a

-- | A sensible default <a>liftShowsPrec</a> implementation for
--   <a>Generic1</a> instances.
liftShowsPrecDefault :: (GShow1 NonV4 (Rep1 f), Generic1 f) => (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS

-- | Like <a>liftShowsPrecDefault</a>, but with configurable
--   <a>Options</a>.
liftShowsPrecOptions :: (GShow1 NonV4 (Rep1 f), Generic1 f) => Options -> (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS

-- | Class of generic representation types that can be converted to a
--   <a>String</a>.
class GShow1 v f
gliftShowsPrec :: GShow1 v f => Options -> Show1Args v a -> Int -> f a -> ShowS

-- | Class of generic representation types that can be converted to a
--   <a>String</a>, and for which the <a>ConType</a> has been determined.
class GShow1Con v f
gliftShowsPrecCon :: GShow1Con v f => Options -> ConType -> Show1Args v a -> Int -> f a -> ShowS

-- | A <a>Show1Args</a> value either stores a <tt>Show a</tt> dictionary
--   (for the <tt>transformers-0.4</tt> version of <a>Show1</a>), or it
--   stores the two function arguments that show occurrences of the type
--   parameter (for the non-<tt>transformers-0.4</tt> version of
--   <a>Show1</a>).
data Show1Args v a
[V4Show1Args] :: Show a => Show1Args V4 a
[NonV4Show1Args] :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Show1Args NonV4 a

-- | A type-level indicator that the <tt>transformers-0.4</tt> version of a
--   class method is being derived generically.
data V4

-- | A type-level indicator that the non-<tt>transformers-0.4</tt> version
--   of a class method is being derived generically.
data NonV4

-- | Whether a constructor is a record (<a>Rec</a>), a tuple (<a>Tup</a>),
--   is prefix (<a>Pref</a>), or infix (<a>Inf</a>).
data ConType
Rec :: ConType
Tup :: ConType
Pref :: ConType
Inf :: String -> ConType

-- | Class of generic representation types that represent a constructor
--   with zero or more fields.
class IsNullary f
isNullary :: IsNullary f => f a -> Bool
instance GHC.Classes.Eq c => Data.Functor.Classes.Generic.Internal.GEq1 v (GHC.Generics.K1 i c)
instance (Data.Functor.Classes.Generic.Internal.GEq1 v f, Data.Functor.Classes.Generic.Internal.GEq1 v g) => Data.Functor.Classes.Generic.Internal.GEq1 v (f GHC.Generics.:*: g)
instance (Data.Functor.Classes.Generic.Internal.GEq1 v f, Data.Functor.Classes.Generic.Internal.GEq1 v g) => Data.Functor.Classes.Generic.Internal.GEq1 v (f GHC.Generics.:+: g)
instance Data.Functor.Classes.Generic.Internal.GEq1 v f => Data.Functor.Classes.Generic.Internal.GEq1 v (GHC.Generics.M1 i c f)
instance Data.Functor.Classes.Generic.Internal.GEq1 v GHC.Generics.U1
instance Data.Functor.Classes.Generic.Internal.GEq1 v GHC.Generics.V1
instance Data.Functor.Classes.Generic.Internal.GEq1 Data.Functor.Classes.Generic.Internal.NonV4 GHC.Generics.Par1
instance Data.Functor.Classes.Eq1 f => Data.Functor.Classes.Generic.Internal.GEq1 Data.Functor.Classes.Generic.Internal.NonV4 (GHC.Generics.Rec1 f)
instance (Data.Functor.Classes.Eq1 f, Data.Functor.Classes.Generic.Internal.GEq1 Data.Functor.Classes.Generic.Internal.NonV4 g) => Data.Functor.Classes.Generic.Internal.GEq1 Data.Functor.Classes.Generic.Internal.NonV4 (f GHC.Generics.:.: g)
instance Data.Functor.Classes.Generic.Internal.GEq1 v GHC.Generics.UAddr
instance Data.Functor.Classes.Generic.Internal.GEq1 v GHC.Generics.UChar
instance Data.Functor.Classes.Generic.Internal.GEq1 v GHC.Generics.UDouble
instance Data.Functor.Classes.Generic.Internal.GEq1 v GHC.Generics.UFloat
instance Data.Functor.Classes.Generic.Internal.GEq1 v GHC.Generics.UInt
instance Data.Functor.Classes.Generic.Internal.GEq1 v GHC.Generics.UWord
instance GHC.Classes.Ord c => Data.Functor.Classes.Generic.Internal.GOrd1 v (GHC.Generics.K1 i c)
instance (Data.Functor.Classes.Generic.Internal.GOrd1 v f, Data.Functor.Classes.Generic.Internal.GOrd1 v g) => Data.Functor.Classes.Generic.Internal.GOrd1 v (f GHC.Generics.:*: g)
instance (Data.Functor.Classes.Generic.Internal.GOrd1 v f, Data.Functor.Classes.Generic.Internal.GOrd1 v g) => Data.Functor.Classes.Generic.Internal.GOrd1 v (f GHC.Generics.:+: g)
instance Data.Functor.Classes.Generic.Internal.GOrd1 v f => Data.Functor.Classes.Generic.Internal.GOrd1 v (GHC.Generics.M1 i c f)
instance Data.Functor.Classes.Generic.Internal.GOrd1 v GHC.Generics.U1
instance Data.Functor.Classes.Generic.Internal.GOrd1 v GHC.Generics.V1
instance Data.Functor.Classes.Generic.Internal.GOrd1 Data.Functor.Classes.Generic.Internal.NonV4 GHC.Generics.Par1
instance Data.Functor.Classes.Ord1 f => Data.Functor.Classes.Generic.Internal.GOrd1 Data.Functor.Classes.Generic.Internal.NonV4 (GHC.Generics.Rec1 f)
instance (Data.Functor.Classes.Ord1 f, Data.Functor.Classes.Generic.Internal.GOrd1 Data.Functor.Classes.Generic.Internal.NonV4 g) => Data.Functor.Classes.Generic.Internal.GOrd1 Data.Functor.Classes.Generic.Internal.NonV4 (f GHC.Generics.:.: g)
instance Data.Functor.Classes.Generic.Internal.GOrd1 v GHC.Generics.UAddr
instance Data.Functor.Classes.Generic.Internal.GOrd1 v GHC.Generics.UChar
instance Data.Functor.Classes.Generic.Internal.GOrd1 v GHC.Generics.UDouble
instance Data.Functor.Classes.Generic.Internal.GOrd1 v GHC.Generics.UFloat
instance Data.Functor.Classes.Generic.Internal.GOrd1 v GHC.Generics.UInt
instance Data.Functor.Classes.Generic.Internal.GOrd1 v GHC.Generics.UWord
instance Data.Functor.Classes.Generic.Internal.GRead1 v f => Data.Functor.Classes.Generic.Internal.GRead1 v (GHC.Generics.D1 d f)
instance Data.Functor.Classes.Generic.Internal.GRead1 v GHC.Generics.V1
instance (Data.Functor.Classes.Generic.Internal.GRead1 v f, Data.Functor.Classes.Generic.Internal.GRead1 v g) => Data.Functor.Classes.Generic.Internal.GRead1 v (f GHC.Generics.:+: g)
instance (GHC.Generics.Constructor c, Data.Functor.Classes.Generic.Internal.GRead1Con v f, Data.Functor.Classes.Generic.Internal.IsNullary f) => Data.Functor.Classes.Generic.Internal.GRead1 v (GHC.Generics.C1 c f)
instance Data.Functor.Classes.Generic.Internal.GRead1Con v GHC.Generics.U1
instance GHC.Read.Read c => Data.Functor.Classes.Generic.Internal.GRead1Con v (GHC.Generics.K1 i c)
instance (GHC.Generics.Selector s, Data.Functor.Classes.Generic.Internal.GRead1Con v f) => Data.Functor.Classes.Generic.Internal.GRead1Con v (GHC.Generics.S1 s f)
instance (Data.Functor.Classes.Generic.Internal.GRead1Con v f, Data.Functor.Classes.Generic.Internal.GRead1Con v g) => Data.Functor.Classes.Generic.Internal.GRead1Con v (f GHC.Generics.:*: g)
instance Data.Functor.Classes.Generic.Internal.GRead1Con Data.Functor.Classes.Generic.Internal.NonV4 GHC.Generics.Par1
instance Data.Functor.Classes.Read1 f => Data.Functor.Classes.Generic.Internal.GRead1Con Data.Functor.Classes.Generic.Internal.NonV4 (GHC.Generics.Rec1 f)
instance (Data.Functor.Classes.Read1 f, Data.Functor.Classes.Generic.Internal.GRead1Con Data.Functor.Classes.Generic.Internal.NonV4 g) => Data.Functor.Classes.Generic.Internal.GRead1Con Data.Functor.Classes.Generic.Internal.NonV4 (f GHC.Generics.:.: g)
instance Data.Functor.Classes.Generic.Internal.GShow1 v f => Data.Functor.Classes.Generic.Internal.GShow1 v (GHC.Generics.D1 d f)
instance Data.Functor.Classes.Generic.Internal.GShow1 v GHC.Generics.V1
instance (Data.Functor.Classes.Generic.Internal.GShow1 v f, Data.Functor.Classes.Generic.Internal.GShow1 v g) => Data.Functor.Classes.Generic.Internal.GShow1 v (f GHC.Generics.:+: g)
instance (GHC.Generics.Constructor c, Data.Functor.Classes.Generic.Internal.GShow1Con v f, Data.Functor.Classes.Generic.Internal.IsNullary f) => Data.Functor.Classes.Generic.Internal.GShow1 v (GHC.Generics.C1 c f)
instance Data.Functor.Classes.Generic.Internal.GShow1Con v GHC.Generics.U1
instance GHC.Show.Show c => Data.Functor.Classes.Generic.Internal.GShow1Con v (GHC.Generics.K1 i c)
instance (GHC.Generics.Selector s, Data.Functor.Classes.Generic.Internal.GShow1Con v f) => Data.Functor.Classes.Generic.Internal.GShow1Con v (GHC.Generics.S1 s f)
instance (Data.Functor.Classes.Generic.Internal.GShow1Con v f, Data.Functor.Classes.Generic.Internal.GShow1Con v g) => Data.Functor.Classes.Generic.Internal.GShow1Con v (f GHC.Generics.:*: g)
instance Data.Functor.Classes.Generic.Internal.GShow1Con Data.Functor.Classes.Generic.Internal.NonV4 GHC.Generics.Par1
instance Data.Functor.Classes.Show1 f => Data.Functor.Classes.Generic.Internal.GShow1Con Data.Functor.Classes.Generic.Internal.NonV4 (GHC.Generics.Rec1 f)
instance (Data.Functor.Classes.Show1 f, Data.Functor.Classes.Generic.Internal.GShow1Con Data.Functor.Classes.Generic.Internal.NonV4 g) => Data.Functor.Classes.Generic.Internal.GShow1Con Data.Functor.Classes.Generic.Internal.NonV4 (f GHC.Generics.:.: g)
instance Data.Functor.Classes.Generic.Internal.GShow1Con v GHC.Generics.UChar
instance Data.Functor.Classes.Generic.Internal.GShow1Con v GHC.Generics.UDouble
instance Data.Functor.Classes.Generic.Internal.GShow1Con v GHC.Generics.UFloat
instance Data.Functor.Classes.Generic.Internal.GShow1Con v GHC.Generics.UInt
instance Data.Functor.Classes.Generic.Internal.GShow1Con v GHC.Generics.UWord
instance Data.Functor.Classes.Generic.Internal.IsNullary GHC.Generics.U1
instance Data.Functor.Classes.Generic.Internal.IsNullary GHC.Generics.Par1
instance Data.Functor.Classes.Generic.Internal.IsNullary (GHC.Generics.K1 i c)
instance Data.Functor.Classes.Generic.Internal.IsNullary f => Data.Functor.Classes.Generic.Internal.IsNullary (GHC.Generics.S1 s f)
instance Data.Functor.Classes.Generic.Internal.IsNullary (GHC.Generics.Rec1 f)
instance Data.Functor.Classes.Generic.Internal.IsNullary (f GHC.Generics.:*: g)
instance Data.Functor.Classes.Generic.Internal.IsNullary (f GHC.Generics.:.: g)
instance Data.Functor.Classes.Generic.Internal.IsNullary GHC.Generics.UChar
instance Data.Functor.Classes.Generic.Internal.IsNullary GHC.Generics.UDouble
instance Data.Functor.Classes.Generic.Internal.IsNullary GHC.Generics.UFloat
instance Data.Functor.Classes.Generic.Internal.IsNullary GHC.Generics.UInt
instance Data.Functor.Classes.Generic.Internal.IsNullary GHC.Generics.UWord


-- | Functions to generically derive <a>Eq1</a>, <a>Ord1</a>, <a>Read1</a>,
--   and <a>Show1</a> instances from <a>Data.Functor.Classes</a>.
module Data.Functor.Classes.Generic

-- | Options that further configure how the functions in
--   <a>Data.Functor.Classes.Generic</a> should behave.
newtype Options
Options :: Bool -> Options

-- | If <a>True</a>, a default <a>Show1</a> implementation will show hash
--   signs (<tt>#</tt>) when showing unlifted types.
[ghc8ShowBehavior] :: Options -> Bool

-- | Options that match the behavior of the installed version of GHC.
defaultOptions :: Options

-- | Options that match the behavior of the most recent GHC release.
latestGHCOptions :: Options

-- | A sensible default <a>liftEq</a> implementation for <a>Generic1</a>
--   instances.
liftEqDefault :: (GEq1 NonV4 (Rep1 f), Generic1 f) => (a -> b -> Bool) -> f a -> f b -> Bool

-- | Like <a>liftEqDefault</a>, but with configurable <a>Options</a>.
--   Currently, the <a>Options</a> have no effect (but this may change in
--   the future).
liftEqOptions :: (GEq1 NonV4 (Rep1 f), Generic1 f) => Options -> (a -> b -> Bool) -> f a -> f b -> Bool

-- | A sensible default <a>liftCompare</a> implementation for
--   <a>Generic1</a> instances.
liftCompareDefault :: (GOrd1 NonV4 (Rep1 f), Generic1 f) => (a -> b -> Ordering) -> f a -> f b -> Ordering

-- | Like <a>liftCompareDefault</a>, but with configurable <a>Options</a>.
--   Currently, the <a>Options</a> have no effect (but this may change in
--   the future).
liftCompareOptions :: (GOrd1 NonV4 (Rep1 f), Generic1 f) => Options -> (a -> b -> Ordering) -> f a -> f b -> Ordering

-- | A sensible default <a>liftReadsPrec</a> implementation for
--   <a>Generic1</a> instances.
liftReadsPrecDefault :: (GRead1 NonV4 (Rep1 f), Generic1 f) => (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (f a)

-- | Like <a>liftReadsPrecDefault</a>, but with configurable
--   <a>Options</a>. Currently, the <a>Options</a> have no effect (but this
--   may change in the future).
liftReadsPrecOptions :: (GRead1 NonV4 (Rep1 f), Generic1 f) => Options -> (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (f a)

-- | A sensible default <a>liftShowsPrec</a> implementation for
--   <a>Generic1</a> instances.
liftShowsPrecDefault :: (GShow1 NonV4 (Rep1 f), Generic1 f) => (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS

-- | Like <a>liftShowsPrecDefault</a>, but with configurable
--   <a>Options</a>.
liftShowsPrecOptions :: (GShow1 NonV4 (Rep1 f), Generic1 f) => Options -> (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS


-- | Selection monad transformer, modelling search algorithms.
--   
--   <ul>
--   <li>Martin Escardo and Paulo Oliva. "Selection functions, bar
--   recursion and backward induction", <i>Mathematical Structures in
--   Computer Science</i> 20:2 (2010), pp. 127-168.
--   <a>https://www.cs.bham.ac.uk/~mhe/papers/selection-escardo-oliva.pdf</a></li>
--   <li>Jules Hedges. "Monad transformers for backtracking search". In
--   <i>Proceedings of MSFP 2014</i>.
--   <a>https://arxiv.org/abs/1406.2058</a></li>
--   </ul>
module Control.Monad.Trans.Select

-- | Selection monad.
type Select r = SelectT r Identity

-- | Constructor for computations in the selection monad.
select :: ((a -> r) -> a) -> Select r a

-- | Runs a <tt>Select</tt> computation with a function for evaluating
--   answers to select a particular answer. (The inverse of <a>select</a>.)
runSelect :: Select r a -> (a -> r) -> a

-- | Apply a function to transform the result of a selection computation.
--   
--   <ul>
--   <li><pre><a>runSelect</a> (<a>mapSelect</a> f m) = f .
--   <a>runSelect</a> m</pre></li>
--   </ul>
mapSelect :: (a -> a) -> Select r a -> Select r a

-- | Selection monad transformer.
--   
--   <a>SelectT</a> is not a functor on the category of monads, and many
--   operations cannot be lifted through it.
newtype SelectT r m a
SelectT :: ((a -> m r) -> m a) -> SelectT r m a

-- | Runs a <tt>SelectT</tt> computation with a function for evaluating
--   answers to select a particular answer. (The inverse of <a>select</a>.)
runSelectT :: SelectT r m a -> (a -> m r) -> m a

-- | Apply a function to transform the result of a selection computation.
--   This has a more restricted type than the <tt>map</tt> operations for
--   other monad transformers, because <a>SelectT</a> does not define a
--   functor in the category of monads.
--   
--   <ul>
--   <li><pre><a>runSelectT</a> (<a>mapSelectT</a> f m) = f .
--   <a>runSelectT</a> m</pre></li>
--   </ul>
mapSelectT :: (m a -> m a) -> SelectT r m a -> SelectT r m a

-- | Convert a selection computation to a continuation-passing computation.
selectToContT :: (Monad m) => SelectT r m a -> ContT r m a

-- | Deprecated name for <a>selectToContT</a>.

-- | <i>Deprecated: Use selectToContT instead</i>
selectToCont :: (Monad m) => SelectT r m a -> ContT r m a
instance GHC.Base.Functor m => GHC.Base.Functor (Control.Monad.Trans.Select.SelectT r m)
instance (GHC.Base.Functor m, GHC.Base.Monad m) => GHC.Base.Applicative (Control.Monad.Trans.Select.SelectT r m)
instance (GHC.Base.Functor m, GHC.Base.MonadPlus m) => GHC.Base.Alternative (Control.Monad.Trans.Select.SelectT r m)
instance GHC.Base.Monad m => GHC.Base.Monad (Control.Monad.Trans.Select.SelectT r m)
instance Control.Monad.Fail.MonadFail m => Control.Monad.Fail.MonadFail (Control.Monad.Trans.Select.SelectT r m)
instance GHC.Base.MonadPlus m => GHC.Base.MonadPlus (Control.Monad.Trans.Select.SelectT r m)
instance Control.Monad.Trans.Class.MonadTrans (Control.Monad.Trans.Select.SelectT r)
instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Control.Monad.Trans.Select.SelectT r m)


-- | Backports orphan instances which are not provided by other modules in
--   <tt>transformers-compat</tt>.
module Control.Monad.Trans.Instances
instance GHC.Base.Monad m => GHC.Base.Monad (Data.Functor.Reverse.Reverse m)
instance Control.Monad.Fail.MonadFail m => Control.Monad.Fail.MonadFail (Data.Functor.Reverse.Reverse m)
instance GHC.Base.MonadPlus m => GHC.Base.MonadPlus (Data.Functor.Reverse.Reverse m)
instance forall k a (b :: k). Data.Semigroup.Semigroup a => Data.Semigroup.Semigroup (Data.Functor.Constant.Constant a b)


-- | The lazy <a>AccumT</a> monad transformer, which adds accumulation
--   capabilities (such as declarations or document patches) to a given
--   monad.
--   
--   This monad transformer provides append-only accumulation during the
--   computation. For more general access, use
--   <a>Control.Monad.Trans.State</a> instead.
module Control.Monad.Trans.Accum

-- | An accumulation monad parameterized by the type <tt>w</tt> of output
--   to accumulate.
--   
--   The <a>return</a> function produces the output <a>mempty</a>, while
--   <tt>&gt;&gt;=</tt> combines the outputs of the subcomputations using
--   <a>mappend</a>.
type Accum w = AccumT w Identity

-- | Construct an accumulation computation from a (result, output) pair.
--   (The inverse of <a>runAccum</a>.)
accum :: (Monad m) => (w -> (a, w)) -> AccumT w m a

-- | Unwrap an accumulation computation as a (result, output) pair. (The
--   inverse of <a>accum</a>.)
runAccum :: Accum w a -> w -> (a, w)

-- | Extract the output from an accumulation computation.
--   
--   <ul>
--   <li><pre><a>execAccum</a> m w = <a>snd</a> (<a>runAccum</a> m
--   w)</pre></li>
--   </ul>
execAccum :: Accum w a -> w -> w

-- | Evaluate an accumulation computation with the given initial output
--   history and return the final value, discarding the final output.
--   
--   <ul>
--   <li><pre><a>evalAccum</a> m w = <a>fst</a> (<a>runAccum</a> m
--   w)</pre></li>
--   </ul>
evalAccum :: (Monoid w) => Accum w a -> w -> a

-- | Map both the return value and output of a computation using the given
--   function.
--   
--   <ul>
--   <li><pre><a>runAccum</a> (<a>mapAccum</a> f m) = f . <a>runAccum</a>
--   m</pre></li>
--   </ul>
mapAccum :: ((a, w) -> (b, w)) -> Accum w a -> Accum w b

-- | An accumulation monad parameterized by:
--   
--   <ul>
--   <li><tt>w</tt> - the output to accumulate.</li>
--   <li><tt>m</tt> - The inner monad.</li>
--   </ul>
--   
--   The <a>return</a> function produces the output <a>mempty</a>, while
--   <tt>&gt;&gt;=</tt> combines the outputs of the subcomputations using
--   <a>mappend</a>.
--   
--   This monad transformer is similar to both state and writer monad
--   transformers. Thus it can be seen as
--   
--   <ul>
--   <li>a restricted append-only version of a state monad transformer
--   or</li>
--   <li>a writer monad transformer with the extra ability to read all
--   previous output.</li>
--   </ul>
newtype AccumT w m a
AccumT :: (w -> m (a, w)) -> AccumT w m a

-- | Unwrap an accumulation computation.
runAccumT :: AccumT w m a -> w -> m (a, w)

-- | Extract the output from an accumulation computation.
--   
--   <ul>
--   <li><pre><a>execAccumT</a> m w = <a>liftM</a> <a>snd</a>
--   (<a>runAccumT</a> m w)</pre></li>
--   </ul>
execAccumT :: (Monad m) => AccumT w m a -> w -> m w

-- | Evaluate an accumulation computation with the given initial output
--   history and return the final value, discarding the final output.
--   
--   <ul>
--   <li><pre><a>evalAccumT</a> m w = <a>liftM</a> <a>fst</a>
--   (<a>runAccumT</a> m w)</pre></li>
--   </ul>
evalAccumT :: (Monad m, Monoid w) => AccumT w m a -> w -> m a

-- | Map both the return value and output of a computation using the given
--   function.
--   
--   <ul>
--   <li><pre><a>runAccumT</a> (<a>mapAccumT</a> f m) = f .
--   <a>runAccumT</a> m</pre></li>
--   </ul>
mapAccumT :: (m (a, w) -> n (b, w)) -> AccumT w m a -> AccumT w n b

-- | <tt><a>look</a></tt> is an action that fetches all the previously
--   accumulated output.
look :: (Monoid w, Monad m) => AccumT w m w

-- | <tt><a>look</a></tt> is an action that retrieves a function of the
--   previously accumulated output.
looks :: (Monoid w, Monad m) => (w -> a) -> AccumT w m a

-- | <tt><a>add</a> w</tt> is an action that produces the output
--   <tt>w</tt>.
add :: (Monad m) => w -> AccumT w m ()

-- | Uniform lifting of a <tt>callCC</tt> operation to the new monad. This
--   version rolls back to the original output history on entering the
--   continuation.
liftCallCC :: CallCC m (a, w) (b, w) -> CallCC (AccumT w m) a b

-- | In-situ lifting of a <tt>callCC</tt> operation to the new monad. This
--   version uses the current output history on entering the continuation.
--   It does not satisfy the uniformity property (see
--   <a>Control.Monad.Signatures</a>).
liftCallCC' :: CallCC m (a, w) (b, w) -> CallCC (AccumT w m) a b

-- | Lift a <tt>catchE</tt> operation to the new monad.
liftCatch :: Catch e m (a, w) -> Catch e (AccumT w m) a

-- | Lift a <tt>listen</tt> operation to the new monad.
liftListen :: (Monad m) => Listen w m (a, s) -> Listen w (AccumT s m) a

-- | Lift a <tt>pass</tt> operation to the new monad.
liftPass :: (Monad m) => Pass w m (a, s) -> Pass w (AccumT s m) a

-- | Convert a read-only computation into an accumulation computation.
readerToAccumT :: (Functor m, Monoid w) => ReaderT w m a -> AccumT w m a

-- | Convert a writer computation into an accumulation computation.
writerToAccumT :: WriterT w m a -> AccumT w m a

-- | Convert an accumulation (append-only) computation into a fully
--   stateful computation.
accumToStateT :: (Functor m, Monoid s) => AccumT s m a -> StateT s m a
instance GHC.Base.Functor m => GHC.Base.Functor (Control.Monad.Trans.Accum.AccumT w m)
instance (GHC.Base.Monoid w, GHC.Base.Functor m, GHC.Base.Monad m) => GHC.Base.Applicative (Control.Monad.Trans.Accum.AccumT w m)
instance (GHC.Base.Monoid w, GHC.Base.Functor m, GHC.Base.MonadPlus m) => GHC.Base.Alternative (Control.Monad.Trans.Accum.AccumT w m)
instance (GHC.Base.Monoid w, GHC.Base.Functor m, GHC.Base.Monad m) => GHC.Base.Monad (Control.Monad.Trans.Accum.AccumT w m)
instance (GHC.Base.Monoid w, Control.Monad.Fail.MonadFail m) => Control.Monad.Fail.MonadFail (Control.Monad.Trans.Accum.AccumT w m)
instance (GHC.Base.Monoid w, GHC.Base.Functor m, GHC.Base.MonadPlus m) => GHC.Base.MonadPlus (Control.Monad.Trans.Accum.AccumT w m)
instance (GHC.Base.Monoid w, GHC.Base.Functor m, Control.Monad.Fix.MonadFix m) => Control.Monad.Fix.MonadFix (Control.Monad.Trans.Accum.AccumT w m)
instance GHC.Base.Monoid w => Control.Monad.Trans.Class.MonadTrans (Control.Monad.Trans.Accum.AccumT w)
instance (GHC.Base.Monoid w, GHC.Base.Functor m, Control.Monad.IO.Class.MonadIO m) => Control.Monad.IO.Class.MonadIO (Control.Monad.Trans.Accum.AccumT w m)
