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


-- | A class for monads which can keep a monadic call trace
--   
--   This package defines a class for monads which can keep a monadic call
--   trace.
--   
--   <ul>
--   <li>See the blog post
--   <a>http://pepeiborra.wordpress.com/2009/11/01/monadic-stack-traces-that-make-a-lot-of-sense</a>
--   for more information.</li>
--   </ul>
--   
--   A preprocessor is available (see the package monadloc-pp) which
--   inserts calls to "Control.Monad.Loc.withLoc" before every monadic
--   statement in a module. To invoke the preprocessor, add the pragma
--   <tt>OPTIONS_GHC -F -pgmF MonadLoc</tt> at the top of your Haskell
--   files together with an import for the <a>Control.Monad.Loc</a> module
--   
--   This package provides no implementation of the
--   <a>Control.Monad.Loc.MonadLoc</a> interface. Currently the only
--   package that does so is <tt>control-monad-exception</tt>, but any
--   other package can implement it and provide monadic call traces.
--   <i>Changes</i>:
--   
--   <ul>
--   <li>0.7 - Extracted Template Haskell macro to separate module to allow
--   <tt>Control.Monad.Loc</tt> to be Safe. (thanks to Deian Stefan)</li>
--   <li>0.6 - Extracted the preprocessor to a separate package
--   <tt>monadloc-pp</tt> to minimize the set of dependencies.</li>
--   </ul>
@package monadloc
@version 0.7.1


-- | This package defines a MonadLoc class for monads which support Monadic
--   Call Traces. See
--   <a>http://pepeiborra.posterous.com/monadic-stack-traces-that-make-a-lot-of-sense</a>
--   
--   <ul>
--   <li>Traces are only provided for explicitly annotated program
--   points.</li>
--   <li>This package installs the MonadLoc preprocessor for this purpose.
--   To enable it include the following pragma at the top of your haskell
--   source files:</li>
--   </ul>
--   
--   <pre>
--   { -# OPTIONS_GHC -F -pgmF MonadLoc #- }
--   </pre>
--   
--   <ul>
--   <li>There is also the TH macro <tt>withLocTH</tt> exported by
--   <a>Control.Monad.Loc.TH</a></li>
--   </ul>
module Control.Monad.Loc

-- | Generating stack traces for failures
class Monad m => MonadLoc m

-- | <a>withLoc</a> records the given source location in the failure trace
--   if the underlying monad supports recording location traces
withLoc :: MonadLoc m => String -> m a -> m a
instance GHC.Base.Monad m => Control.Monad.Loc.MonadLoc m


-- | The TH macro <a>withLocTH</a> to manually annotate program points, but
--   you should always use the preprocessor if possible.
module Control.Monad.Loc.TH

-- | <a>withLocTH</a> is a convenient TH macro which expands to
--   <a>withLoc</a> <tt>&lt;source location&gt;</tt> It should only be used
--   when the MonadLoc preprocessor is not available. Usage:
--   
--   <pre>
--   f x = $withLocTH $ do
--            $withLocTH $ something
--            x &lt; -$withLocTH $ something-else
--            ...
--   </pre>
--   
--   NOTE: unfortunately type signatures are necessary when using withLocTH
withLocTH :: Q Exp


-- | This package contains MonadLoc instance declarations for the monad
--   transformer type constructors in the <tt>transformers</tt> package.
module Control.Monad.Loc.Transformers
instance Control.Monad.Loc.MonadLoc m => Control.Monad.Loc.MonadLoc (Control.Monad.Trans.List.ListT m)
instance (Control.Monad.Trans.Error.Error e, Control.Monad.Loc.MonadLoc m) => Control.Monad.Loc.MonadLoc (Control.Monad.Trans.Error.ErrorT e m)
instance Control.Monad.Loc.MonadLoc m => Control.Monad.Loc.MonadLoc (Control.Monad.Trans.Reader.ReaderT r m)
instance (GHC.Base.Monoid w, Control.Monad.Loc.MonadLoc m) => Control.Monad.Loc.MonadLoc (Control.Monad.Trans.Writer.Lazy.WriterT w m)
instance Control.Monad.Loc.MonadLoc m => Control.Monad.Loc.MonadLoc (Control.Monad.Trans.State.Lazy.StateT s m)
instance (GHC.Base.Monoid w, Control.Monad.Loc.MonadLoc m) => Control.Monad.Loc.MonadLoc (Control.Monad.Trans.RWS.Lazy.RWST r w s m)
instance (GHC.Base.Monoid w, Control.Monad.Loc.MonadLoc m) => Control.Monad.Loc.MonadLoc (Control.Monad.Trans.Writer.Strict.WriterT w m)
instance Control.Monad.Loc.MonadLoc m => Control.Monad.Loc.MonadLoc (Control.Monad.Trans.State.Strict.StateT s m)
instance (GHC.Base.Monoid w, Control.Monad.Loc.MonadLoc m) => Control.Monad.Loc.MonadLoc (Control.Monad.Trans.RWS.Strict.RWST r w s m)
