Skip to content

Commit df2877a

Browse files
authored
Merge pull request #500 from IntersectMBO/jdral/throwio
Use `throwIO` instead of `throw` in `retrieveBlobs`
2 parents 016716c + b305a8b commit df2877a

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/Database/LSMTree.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ module Database.LSMTree (
100100
) where
101101

102102
import Control.DeepSeq
103-
import Control.Exception (throw)
104103
import Control.Monad
104+
import Control.Monad.Class.MonadThrow
105105
import Data.Bifunctor (Bifunctor (..))
106106
import Data.Coerce (coerce)
107107
import Data.Kind (Type)
@@ -454,11 +454,11 @@ retrieveBlobs ::
454454
-> m (V.Vector b)
455455
retrieveBlobs (Internal.Session' (sesh :: Internal.Session m h)) refs =
456456
V.map Internal.deserialiseBlob <$>
457-
Internal.retrieveBlobs sesh (V.imap checkBlobRefType refs)
457+
(Internal.retrieveBlobs sesh =<< V.imapM checkBlobRefType refs)
458458
where
459459
checkBlobRefType _ (BlobRef (ref :: Internal.WeakBlobRef m h'))
460-
| Just Refl <- eqT @h @h' = ref
461-
checkBlobRefType i _ = throw (Internal.ErrBlobRefInvalid i)
460+
| Just Refl <- eqT @h @h' = pure ref
461+
checkBlobRefType i _ = throwIO (Internal.ErrBlobRefInvalid i)
462462

463463
{-------------------------------------------------------------------------------
464464
Snapshots

src/Database/LSMTree/Normal.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ module Database.LSMTree.Normal (
112112
) where
113113

114114
import Control.DeepSeq
115-
import Control.Exception (throw)
116115
import Control.Monad
116+
import Control.Monad.Class.MonadThrow
117117
import Data.Bifunctor (Bifunctor (..))
118118
import Data.Kind (Type)
119119
import Data.Typeable (eqT, type (:~:) (Refl))
@@ -625,11 +625,11 @@ retrieveBlobs ::
625625
-> m (V.Vector b)
626626
retrieveBlobs (Internal.Session' (sesh :: Internal.Session m h)) refs =
627627
V.map Internal.deserialiseBlob <$>
628-
Internal.retrieveBlobs sesh (V.imap checkBlobRefType refs)
628+
(Internal.retrieveBlobs sesh =<< V.imapM checkBlobRefType refs)
629629
where
630630
checkBlobRefType _ (BlobRef (ref :: Internal.WeakBlobRef m h'))
631-
| Just Refl <- eqT @h @h' = ref
632-
checkBlobRefType i _ = throw (Internal.ErrBlobRefInvalid i)
631+
| Just Refl <- eqT @h @h' = pure ref
632+
checkBlobRefType i _ = throwIO (Internal.ErrBlobRefInvalid i)
633633

634634
{-------------------------------------------------------------------------------
635635
Snapshots

0 commit comments

Comments
 (0)