This package defines a MonadLoc class for monads which support Monadic Call Traces. See http:pepeiborra.posterous.com/monadic-stack-traces-that-make-a-lot-of-sense

- Traces are only provided for explicitly annotated program points.
- This package installs the MonadLoc preprocessor for this purpose. To enable it include the following pragma at the top of your haskell source files:

{ -# OPTIONS_GHC -F -pgmF MonadLoc #- }

- There is also the TH macro
`withLocTH`

to manually annotate program points, but you should always use the preprocessor if possible.

# Documentation

class Monad m => MonadLoc m whereSource

Generating stack traces for failures

withLoc :: String -> m a -> m aSource

`withLoc`

records the given source location in the failure trace
if the underlying monad supports recording location traces

Monad m => MonadLoc m | |

MonadLoc m => MonadLoc (ListT m) | |

MonadLoc m => MonadLoc (ListT m) | |

(Error e, MonadLoc m) => MonadLoc (ErrorT e m) | |

(Error e, MonadLoc m) => MonadLoc (ErrorT e m) | |

MonadLoc m => MonadLoc (ReaderT r m) | |

MonadLoc m => MonadLoc (ReaderT r m) | |

MonadLoc m => MonadLoc (StateT s m) | |

MonadLoc m => MonadLoc (StateT s m) | |

MonadLoc m => MonadLoc (StateT s m) | |

MonadLoc m => MonadLoc (StateT s m) | |

(Monoid w, MonadLoc m) => MonadLoc (WriterT w m) | |

(Monoid w, MonadLoc m) => MonadLoc (WriterT w m) | |

(Monoid w, MonadLoc m) => MonadLoc (WriterT w m) | |

(Monoid w, MonadLoc m) => MonadLoc (WriterT w m) | |

(Monoid w, MonadLoc m) => MonadLoc (RWST r w s m) | |

(Monoid w, MonadLoc m) => MonadLoc (RWST r w s m) | |

(Monoid w, MonadLoc m) => MonadLoc (RWST r w s m) | |

(Monoid w, MonadLoc m) => MonadLoc (RWST r w s m) |

`withLocTH`

is a convenient TH macro which expands to `withLoc`

`<source location>`

It should only be used when the MonadLoc preprocessor is not available.
Usage:

f x = $withLocTH $ do $withLocTH $ something x < -$withLocTH $ something-else ...

NOTE: unfortunately type signatures are necessary when using withLocTH