monad-validate 1.2.0.1 → 1.2.0.2
raw patch · 5 files changed
+22/−15 lines, 5 filesdep ~mtlPVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
Dependency ranges changed: mtl
API changes (from Hackage documentation)
+ Control.Monad.Validate.Internal: invalidRestoreError :: a
Files
- CHANGELOG.md +4/−0
- LICENSE +1/−1
- README.md +1/−1
- monad-validate.cabal +2/−1
- src/Control/Monad/Validate/Internal.hs +14/−12
CHANGELOG.md view
@@ -1,3 +1,7 @@+# 1.2.0.2 [2023-08-17]++- Added support for mtl 2.3.+ # 1.2.0.1 [2022-07-05] - Added support for GHC 9.0 and 9.2.
LICENSE view
@@ -1,4 +1,4 @@-Copyright 2019 Hasura+Copyright 2019 Hasura, 2022 Alexis King Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice
README.md view
@@ -1,4 +1,4 @@-# monad-validate [](https://github.com/lexi-lambda/monad-validate/actions/workflows/build.yml) [][hackage]+# monad-validate [](https://github.com/lexi-lambda/monad-validate/actions/workflows/build.yml) [][hackage] A Haskell library providing the `ValidateT` monad transformer, designed for writing data validations that provide high-quality error reporting without much effort. `ValidateT` automatically exploits the data dependencies of your program—as encoded implicitly in uses of `fmap`, `<*>`, and `>>=`—to report as many errors as possible upon failure instead of completely aborting at the first one.
monad-validate.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: monad-validate-version: 1.2.0.1+version: 1.2.0.2 category: Control build-type: Simple @@ -70,6 +70,7 @@ TupleSections TypeApplications TypeFamilies+ TypeOperators build-depends: , base >=4.12 && <5
src/Control/Monad/Validate/Internal.hs view
@@ -5,6 +5,7 @@ -- "Control.Monad.Validate" for the public interface. module Control.Monad.Validate.Internal where +import Control.Monad ((<=<)) import Control.Monad.IO.Class import Control.Monad.Base import Control.Monad.Catch@@ -16,7 +17,6 @@ import Data.Functor import Data.Functor.Identity import Data.Tuple (swap)-import GHC.Stack (HasCallStack) import Control.Monad.Validate.Class @@ -327,7 +327,6 @@ Right . (e,) <$> f (fmap ValidateTState . unValidateT e) {-# INLINABLE liftWith #-} - restoreT :: (HasCallStack, Monad m) => m (StT (ValidateT e) a) -> ValidateT e m a restoreT m = validateT $ \e1 -> do ValidateTState r <- m case e1 of@@ -338,17 +337,20 @@ MJust _ -> case r of Left e2 -> pure $ Left e2 Right (MJust e2, v) -> pure $ Right (MJust e2, v)- Right (MNothing, _) -> error- $ "Control.Monad.Validate.ValidateT#restoreT: panic!\n"- <> " An attempt was made to restore from a state captured before any validation\n"- <> " errors occurred into a context with validation errors. This is probably the\n"- <> " result of an incorrect use of MonadBaseControl (as validation errors should\n"- <> " strictly increase). Ensure that all state is restored immediately upon\n"- <> " returning from the base monad (or is not restored at all).\n"- <> "\n"- <> " If you believe your use of MonadBaseControl is not in error, and this is a bug\n"- <> " in ValidateT, please submit a bug report."+ Right (MNothing, _) -> invalidRestoreError {-# INLINABLE restoreT #-}++invalidRestoreError :: a+invalidRestoreError = error+ "Control.Monad.Validate.ValidateT#restoreT: panic!\n\+ \ An attempt was made to restore from a state captured before any validation\n\+ \ errors occurred into a context with validation errors. This is probably the\n\+ \ result of an incorrect use of MonadBaseControl (as validation errors should\n\+ \ strictly increase). Ensure that all state is restored immediately upon\n\+ \ returning from the base monad (or is not restored at all).\n\+ \\n\+ \ If you believe your use of MonadBaseControl is not in error, and this is a\n\+ \ bug in ValidateT, please submit a bug report." instance (MonadBaseControl b m) => MonadBaseControl b (ValidateT e m) where type StM (ValidateT e m) a = ComposeSt (ValidateT e) m a