diff options
Diffstat (limited to 'src/HaddockParse.y')
-rw-r--r-- | src/HaddockParse.y | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/HaddockParse.y b/src/HaddockParse.y index 0c5ebf49..6e0f8b6f 100644 --- a/src/HaddockParse.y +++ b/src/HaddockParse.y @@ -3,8 +3,6 @@ module HaddockParse (parseParas, parseString) where import HaddockLex import HaddockTypes - -import MonadError } %tokentype { Token } @@ -59,5 +57,13 @@ elem :: { ParsedDoc } { happyError :: [Token] -> Either String a happyError toks = - throwError ("parse error in doc string: " ++ show (take 3 toks)) + Left ("parse error in doc string: " ++ show (take 3 toks)) + +-- Either monad (we can't use MonadError because GHC < 5.00 has +-- an older incompatible version). +instance Monad (Either String) where + return = Right + Left l >>= _ = Left l + Right r >>= k = k r + fail msg = Left msg } |