From 0736516512c22cd4ceb909d38054698ddac37080 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Gr=C3=B6ber?= Date: Mon, 21 Jul 2014 00:22:45 +0200 Subject: [PATCH] Document exposed parts of GhcMod.Monad --- Language/Haskell/GhcMod/Monad.hs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Language/Haskell/GhcMod/Monad.hs b/Language/Haskell/GhcMod/Monad.hs index a323f6b..a27f7d0 100644 --- a/Language/Haskell/GhcMod/Monad.hs +++ b/Language/Haskell/GhcMod/Monad.hs @@ -127,10 +127,22 @@ instance Error GhcModError where ---------------------------------------------------------------- +-- | A constraint alias (-XConstraintKinds) to make functions dealing with +-- 'GhcModT' somewhat cleaner. +-- +-- Basicially an @IOish m => m@ is a 'Monad' supporting arbitrary 'IO' and +-- exception handling. Usually this will simply be 'IO' but we parametrise it in +-- the exported API so users have the option to use a custom underlying monad. type IOish m = (Functor m, MonadIO m, MonadBaseControl IO m) type GhcMod a = GhcModT (ErrorT GhcModError IO) a +-- | The GhcMod monad transformer data type. This is basically a wrapper around +-- RWST with custom instances for 'GhcMonad' and it's constraints. +-- +-- The inner monad should have instances for 'MonadIO' and 'MonadBaseControl' +-- 'IO'. Most @mtl@ monads already have 'MonadBaseControl' 'IO' instances, see +-- the @monad-control@ package. newtype GhcModT m a = GhcModT { unGhcModT :: RWST GhcModEnv GhcModWriter GhcModState m a } deriving (Functor