Skip to content

Commit

Permalink
Fix MonadThrow instance
Browse files Browse the repository at this point in the history
Since Ok can store any exception in makes no reason to erase type of exception
and convert it to ErrorCall

This also makes MonadThrow instance not conditional on existence of MonadFail
instances
  • Loading branch information
Shimuuar authored and jchia committed Mar 3, 2024
1 parent 1a21d8d commit 5c3558e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Database/SQLite/Simple/Ok.hs
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,11 @@ instance Monad Ok where
#if MIN_VERSION_base(4,9,0)
instance MonadFail Ok where
fail str = Errors [SomeException (ErrorCall str)]
#endif

instance MonadThrow Ok where
throwM = fail . show
#endif
throwM = Errors . pure . toException


-- | a way to reify a list of exceptions into a single exception

Expand Down

0 comments on commit 5c3558e

Please sign in to comment.