Skip to content

Commit

Permalink
Merge pull request #500 from IntersectMBO/jdral/throwio
Browse files Browse the repository at this point in the history
Use `throwIO` instead of `throw` in `retrieveBlobs`
  • Loading branch information
dcoutts authored Dec 17, 2024
2 parents 016716c + b305a8b commit df2877a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/Database/LSMTree.hs
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ module Database.LSMTree (
) where

import Control.DeepSeq
import Control.Exception (throw)
import Control.Monad
import Control.Monad.Class.MonadThrow
import Data.Bifunctor (Bifunctor (..))
import Data.Coerce (coerce)
import Data.Kind (Type)
Expand Down Expand Up @@ -454,11 +454,11 @@ retrieveBlobs ::
-> m (V.Vector b)
retrieveBlobs (Internal.Session' (sesh :: Internal.Session m h)) refs =
V.map Internal.deserialiseBlob <$>
Internal.retrieveBlobs sesh (V.imap checkBlobRefType refs)
(Internal.retrieveBlobs sesh =<< V.imapM checkBlobRefType refs)
where
checkBlobRefType _ (BlobRef (ref :: Internal.WeakBlobRef m h'))
| Just Refl <- eqT @h @h' = ref
checkBlobRefType i _ = throw (Internal.ErrBlobRefInvalid i)
| Just Refl <- eqT @h @h' = pure ref
checkBlobRefType i _ = throwIO (Internal.ErrBlobRefInvalid i)

{-------------------------------------------------------------------------------
Snapshots
Expand Down
8 changes: 4 additions & 4 deletions src/Database/LSMTree/Normal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ module Database.LSMTree.Normal (
) where

import Control.DeepSeq
import Control.Exception (throw)
import Control.Monad
import Control.Monad.Class.MonadThrow
import Data.Bifunctor (Bifunctor (..))
import Data.Kind (Type)
import Data.Typeable (eqT, type (:~:) (Refl))
Expand Down Expand Up @@ -625,11 +625,11 @@ retrieveBlobs ::
-> m (V.Vector b)
retrieveBlobs (Internal.Session' (sesh :: Internal.Session m h)) refs =
V.map Internal.deserialiseBlob <$>
Internal.retrieveBlobs sesh (V.imap checkBlobRefType refs)
(Internal.retrieveBlobs sesh =<< V.imapM checkBlobRefType refs)
where
checkBlobRefType _ (BlobRef (ref :: Internal.WeakBlobRef m h'))
| Just Refl <- eqT @h @h' = ref
checkBlobRefType i _ = throw (Internal.ErrBlobRefInvalid i)
| Just Refl <- eqT @h @h' = pure ref
checkBlobRefType i _ = throwIO (Internal.ErrBlobRefInvalid i)

{-------------------------------------------------------------------------------
Snapshots
Expand Down

0 comments on commit df2877a

Please sign in to comment.