diff --git a/bitcoin.cabal b/bitcoin.cabal index 458032d9..e3766ae2 100644 --- a/bitcoin.cabal +++ b/bitcoin.cabal @@ -107,7 +107,6 @@ library , hashable >=1.3.0.0 , hspec >=2.7.1 , memory >=0.15.0 - , mtl >=2.2.2 , murmur3 >=1.0.3 , network >=3.1.1.1 , safe >=0.3.18 @@ -164,7 +163,6 @@ test-suite spec , lens >=4.18.1 , lens-aeson >=1.1 , memory >=0.15.0 - , mtl >=2.2.2 , murmur3 >=1.0.3 , network >=3.1.1.1 , safe >=0.3.18 diff --git a/package.yaml b/package.yaml index 94de61c5..612ce464 100644 --- a/package.yaml +++ b/package.yaml @@ -33,7 +33,6 @@ dependencies: - hashable >= 1.3.0.0 - hspec >= 2.7.1 - memory >= 0.15.0 - - mtl >= 2.2.2 - murmur3 >= 1.0.3 - network >= 3.1.1.1 - QuickCheck >= 2.13.2 diff --git a/src/Haskoin/Block/Headers.hs b/src/Haskoin/Block/Headers.hs index 3c2229f6..b89a4788 100644 --- a/src/Haskoin/Block/Headers.hs +++ b/src/Haskoin/Block/Headers.hs @@ -72,19 +72,19 @@ module Haskoin.Block.Headers ( import Control.Applicative ((<|>)) import Control.DeepSeq import Control.Monad (guard, mzero, unless, when) -import Control.Monad.Except ( +import Control.Monad.Trans.Class (lift) +import Control.Monad.Trans.Except ( ExceptT (..), runExceptT, - throwError, + throwE, ) -import Control.Monad.State.Strict as State ( +import Control.Monad.Trans.Maybe +import Control.Monad.Trans.State.Strict as State ( StateT, get, gets, - lift, modify, ) -import Control.Monad.Trans.Maybe import Data.Binary (Binary (..)) import Data.Bits (shiftL, shiftR, (.&.)) import qualified Data.ByteString as B @@ -332,7 +332,7 @@ connectBlocks _ _ [] = return $ Right [] connectBlocks net t bhs@(bh : _) = runExceptT $ do unless (chained bhs) $ - throwError "Blocks to connect do not form a chain" + throwE "Blocks to connect do not form a chain" par <- maybeToExceptT "Could not get parent block" @@ -356,13 +356,13 @@ connectBlocks net t bhs@(bh : _) = case skM of Just sk -> return sk Nothing -> - throwError $ + throwE $ "BUG: Could not get skip for block " ++ show (headerHash $ nodeHeader par) | otherwise = do let sn = ls !! fromIntegral (nodeHeight par - sh) when (nodeHeight sn /= sh) $ - throwError "BUG: Node height not right in skip" + throwE "BUG: Node height not right in skip" return sn where sh = skipHeight (nodeHeight par + 1) @@ -403,7 +403,7 @@ connectBlock net t bh = case skM of Just sk -> return sk Nothing -> - throwError $ + throwE $ "BUG: Could not get skip for block " ++ show (headerHash $ nodeHeader par) bb <- lift getBestBlockHeader diff --git a/src/Haskoin/Transaction/Builder.hs b/src/Haskoin/Transaction/Builder.hs index ea0cbf53..b1113876 100644 --- a/src/Haskoin/Transaction/Builder.hs +++ b/src/Haskoin/Transaction/Builder.hs @@ -34,7 +34,7 @@ module Haskoin.Transaction.Builder ( import Control.Applicative ((<|>)) import Control.Arrow (first) import Control.Monad (foldM, unless) -import Control.Monad.Identity (runIdentity) +import Control.Monad.Trans.Identity (runIdentityT) import Crypto.Secp256k1 import qualified Data.ByteString as B import Data.Bytes.Get diff --git a/src/Haskoin/Util.hs b/src/Haskoin/Util.hs index 5c819520..2feb8808 100644 --- a/src/Haskoin/Util.hs +++ b/src/Haskoin/Util.hs @@ -25,7 +25,6 @@ module Haskoin.Util ( -- * Maybe & Either Helpers eitherToMaybe, maybeToEither, - liftEither, liftMaybe, -- * Other Helpers @@ -58,7 +57,7 @@ module Haskoin.Util ( ) where import Control.Monad -import Control.Monad.Except (ExceptT (..), liftEither) +import Control.Monad.Trans.Except (ExceptT (..)) import Data.Bits import Data.ByteString (ByteString) import qualified Data.ByteString as BS @@ -154,7 +153,7 @@ maybeToEither err = maybe (Left err) Right -- | Lift a 'Maybe' computation into the 'ExceptT' monad. liftMaybe :: Monad m => b -> Maybe a -> ExceptT b m a -liftMaybe err = liftEither . maybeToEither err +liftMaybe err = ExceptT . pure . maybeToEither err -- Various helpers