aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Waern <david.waern@gmail.com>2007-11-11 02:21:19 +0000
committerDavid Waern <david.waern@gmail.com>2007-11-11 02:21:19 +0000
commit3f749b43aa90adb94d3faeb5c3b0f7cc38523817 (patch)
treee20890c6a9aa7958bd14d229c17053d8919c0524 /src
parenta37df6aa14d02396f80704683f8e1a1fd59ce2b1 (diff)
Manual merge of a patch from Duncan Coutts that removes the dependency on mtl
Diffstat (limited to 'src')
-rw-r--r--src/Haddock/Interface.hs1
-rw-r--r--src/Haddock/Interface/Create.hs2
-rw-r--r--src/Haddock/Interface/Rename.hs1
-rw-r--r--src/Haddock/Types.hs16
4 files changed, 14 insertions, 6 deletions
diff --git a/src/Haddock/Interface.hs b/src/Haddock/Interface.hs
index 4b178bf4..5f40422e 100644
--- a/src/Haddock/Interface.hs
+++ b/src/Haddock/Interface.hs
@@ -24,7 +24,6 @@ import Haddock.GHC.Utils
import qualified Data.Map as Map
import Data.Map (Map)
import Data.List
-import Control.Monad.Writer
import Control.Monad
import Name
diff --git a/src/Haddock/Interface/Create.hs b/src/Haddock/Interface/Create.hs
index 800f099e..24db83b9 100644
--- a/src/Haddock/Interface/Create.hs
+++ b/src/Haddock/Interface/Create.hs
@@ -19,7 +19,7 @@ import Data.List
import Data.Maybe
import Data.Char
import Data.Ord
-import Control.Monad.Writer
+import Control.Monad
import GHC
import Outputable
diff --git a/src/Haddock/Interface/Rename.hs b/src/Haddock/Interface/Rename.hs
index 2c231960..81717716 100644
--- a/src/Haddock/Interface/Rename.hs
+++ b/src/Haddock/Interface/Rename.hs
@@ -26,7 +26,6 @@ import Prelude hiding (mapM)
import Data.Traversable (mapM)
import Control.Arrow
import Control.Monad hiding (mapM)
-import Control.Monad.Writer hiding (mapM)
renameInterface :: LinkEnv -> Interface -> ErrMsgM Interface
diff --git a/src/Haddock/Types.hs b/src/Haddock/Types.hs
index 6143ae02..f1e01459 100644
--- a/src/Haddock/Types.hs
+++ b/src/Haddock/Types.hs
@@ -10,7 +10,6 @@ module Haddock.Types where
import Data.Map (Map)
import qualified Data.Map as Map
-import Control.Monad.Writer
import GHC hiding (NoLink)
import Outputable
@@ -203,7 +202,18 @@ data DocMarkup id a = Markup {
}
--- A monad which collects error messages
+-- A monad which collects error messages, locally defined to avoid a dep on mtl
type ErrMsg = String
-type ErrMsgM a = Writer [ErrMsg] a
+
+newtype ErrMsgM a = Writer { runWriter :: (a, [ErrMsg]) }
+
+instance Monad ErrMsgM where
+ return a = Writer (a, [])
+ m >>= k = Writer $ let
+ (a, w) = runWriter m
+ (b, w') = runWriter (k a)
+ in (b, w ++ w')
+
+tell :: [ErrMsg] -> ErrMsgM ()
+tell w = Writer ((), w)