Skip to content

Commit

Permalink
Merge pull request #111 from TripShot/mtl-2.3
Browse files Browse the repository at this point in the history
Enable building with mtl-2.3+
  • Loading branch information
tvh authored Jul 1, 2024
2 parents ae8084f + 34d7903 commit 035d488
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
1 change: 0 additions & 1 deletion hprotoc/Text/ProtocolBuffers/ProtoCompile/Lexer.x
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
{-# OPTIONS_GHC -Wwarn #-}
module Text.ProtocolBuffers.ProtoCompile.Lexer (Lexed(..), alexScanTokens,getLinePos) where

import Control.Monad.Error()
import Codec.Binary.UTF8.String(encode)
import qualified Data.ByteString.Lazy as DBL
import Data.Char(ord,isHexDigit,isOctDigit,toLower)
Expand Down
9 changes: 5 additions & 4 deletions hprotoc/Text/ProtocolBuffers/ProtoCompile/Resolve.hs
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,11 @@ import Text.ProtocolBuffers.ProtoCompile.Parser

import Control.Applicative
import Control.Arrow (first)
import Control.Monad ((>=>), liftM, when)
import Control.Monad.Identity
import Control.Monad.State
import Control.Monad.Reader
import Control.Monad.Error
import Control.Monad.Error.Class (MonadError(..))
import Control.Monad.Writer
import Data.Char
import Data.Ratio
Expand Down Expand Up @@ -187,13 +188,13 @@ errMsg s = "Text.ProtocolBuffers.ProtoCompile.Resolve fatal error encountered, m
err :: forall b. String -> b
err = error . errMsg

throw :: (Error e, MonadError e m) => String -> m a
throw s = throwError (strMsg (errMsg s))
throw :: (MonadError String m) => String -> m a
throw s = throwError (errMsg s)

annErr :: (MonadError String m) => String -> m a -> m a
annErr s act = catchError act (\e -> throwError ("Text.ProtocolBuffers.ProtoCompile.Resolve annErr: "++s++'\n':indent e))

getJust :: (Error e,MonadError e m, Typeable a) => String -> Maybe a -> m a
getJust :: (MonadError String m, Typeable a) => String -> Maybe a -> m a
{-# INLINE getJust #-}
getJust s ma@Nothing = throw $ "Impossible? Expected Just of type "++show (typeOf ma)++" but got nothing:\n"++indent s
getJust _s (Just a) = return a
Expand Down
2 changes: 1 addition & 1 deletion protocol-buffers.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Library
containers,
directory,
filepath,
mtl,
mtl >= 2.1.3,
vector,
parsec,
utf8-string,
Expand Down

0 comments on commit 035d488

Please sign in to comment.