Skip to content

Commit

Permalink
replace usage of 'mtl' with 'transformers'
Browse files Browse the repository at this point in the history
There's no strong feeling about using one or another. Transformers is
slightly simpler as it doesn't introduce any of the type-classes and
functional dependencies that 'mtl' adds. Though, we only use the power
of 'transformers' so far, and thus, for consistency at least, let's
stick with this one and only pull 'mtl' if we feel it becomes a need
  • Loading branch information
KtorZ committed Mar 19, 2019
1 parent 8b1bcbc commit 8be546a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
2 changes: 0 additions & 2 deletions cardano-wallet.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ library
, http-client
, http-media
, memory
, mtl
, say
, servant
, servant-client
Expand Down Expand Up @@ -105,7 +104,6 @@ test-suite unit
, fmt
, hspec
, memory
, mtl
, process
, QuickCheck
, text
Expand Down
4 changes: 2 additions & 2 deletions src/Cardano/NetworkLayer.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ import Cardano.Wallet.Primitive
( Block (..), BlockHeader (..), Hash (..), SlotId (..) )
import Control.Concurrent
( threadDelay )
import Control.Monad.Except
( ExceptT, runExceptT )
import Control.Monad.IO.Class
( MonadIO, liftIO )
import Control.Monad.Trans.Except
( ExceptT, runExceptT )
import Data.Time.Units
( Millisecond, toMicroseconds )
import Fmt
Expand Down
8 changes: 5 additions & 3 deletions src/Cardano/NetworkLayer/HttpBridge.hs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ import Cardano.Wallet.Primitive
( Block (..), BlockHeader (..), Hash (..), SlotId (..) )
import Control.Exception
( Exception (..) )
import Control.Monad.Except
( ExceptT (..), lift, runExceptT, throwError )
import Control.Monad.Trans.Class
( lift )
import Control.Monad.Trans.Except
( ExceptT (..), runExceptT, throwE )
import Crypto.Hash
( HashAlgorithm, digestFromByteString )
import Crypto.Hash.Algorithms
Expand Down Expand Up @@ -240,7 +242,7 @@ hashToApi'
-> ExceptT HttpBridgeError m (Api.Hash algorithm b)
hashToApi' h = case hashToApi h of
Just h' -> pure h'
Nothing -> throwError
Nothing -> throwE
$ BadResponseFromNode "hashToApi: Digest was of the wrong length"

-- | Creates a cardano-http-bridge API with the given connection settings.
Expand Down
8 changes: 5 additions & 3 deletions test/unit/Cardano/NetworkLayer/HttpBridgeSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ import Cardano.Wallet.Primitive
( Block (..), BlockHeader (..), Hash (..), SlotId (..), slotsPerEpoch )
import Control.Monad.Catch
( MonadThrow (..) )
import Control.Monad.Except
( lift, runExceptT, throwError )
import Control.Monad.Trans.Class
( lift )
import Control.Monad.Trans.Except
( runExceptT, throwE )
import Data.Word
( Word64 )
import Test.Hspec
Expand Down Expand Up @@ -131,7 +133,7 @@ mockHttpBridge logLine firstUnstableEpoch tip = HttpBridge
if ep < firstUnstableEpoch then
pure $ mockEpoch ep
else
throwError $
throwE $
"mock epoch " ++ show ep ++ " > firstUnstableEpoch " ++
show firstUnstableEpoch

Expand Down

0 comments on commit 8be546a

Please sign in to comment.