packages feed

conformance 0.0.0.0 → 0.1.0.0

raw patch · 3 files changed

+20/−10 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

- Conformance: instance GHC.Base.Monad m => Control.Monad.Reader.Class.MonadReader (fe -> GHC.Types.Bool) (Conformance.ConformT ue fe w m)
+ Conformance: instance GHC.Base.Monad m => Control.Monad.Reader.Class.MonadReader (fe -> m GHC.Types.Bool) (Conformance.ConformT ue fe w m)
- Conformance: ConformT :: ReaderT (fe -> Bool) (WriterT (Notes fe w) (ExceptT (HaltReason ue fe) m)) a -> ConformT ue fe w m a
+ Conformance: ConformT :: ReaderT (fe -> m Bool) (WriterT (Notes fe w) (ExceptT (HaltReason ue fe) m)) a -> ConformT ue fe w m a
- Conformance: [unConformT] :: ConformT ue fe w m a -> ReaderT (fe -> Bool) (WriterT (Notes fe w) (ExceptT (HaltReason ue fe) m)) a
+ Conformance: [unConformT] :: ConformT ue fe w m a -> ReaderT (fe -> m Bool) (WriterT (Notes fe w) (ExceptT (HaltReason ue fe) m)) a
- Conformance: fixAll :: fe -> Bool
+ Conformance: fixAll :: Applicative m => fe -> m Bool
- Conformance: fixNone :: fe -> Bool
+ Conformance: fixNone :: Applicative m => fe -> m Bool
- Conformance: runConformTFlexible :: (fe -> Bool) -> ConformT ue fe w m a -> m (Either (HaltReason ue fe) (a, Notes fe w))
+ Conformance: runConformTFlexible :: (fe -> m Bool) -> ConformT ue fe w m a -> m (Either (HaltReason ue fe) (a, Notes fe w))

Files

+ CHANGELOG.md view
@@ -0,0 +1,7 @@+# Changelog++## [0.1.0.0] - 2023-11-08++### Changed++* Changed the fixable error predicate to be monadic.
conformance.cabal view
@@ -5,11 +5,13 @@ -- see: https://github.com/sol/hpack  name:           conformance-version:        0.0.0.0+version:        0.1.0.0 description:    An RFC 2119 Monad transformer maintainer:     Tom Sydney Kerckhove <syd@cs-syd.eu> license:        MIT build-type:     Simple+extra-source-files:+    CHANGELOG.md  library   exposed-modules:
src/Conformance.hs view
@@ -30,13 +30,13 @@ --    The @w@ parameter represents warnings to represent cases where requirements or prohibitions were violated. newtype ConformT ue fe w m a = ConformT   { unConformT ::-      ReaderT (fe -> Bool) (WriterT (Notes fe w) (ExceptT (HaltReason ue fe) m)) a+      ReaderT (fe -> m Bool) (WriterT (Notes fe w) (ExceptT (HaltReason ue fe) m)) a   }   deriving newtype     ( Functor,       Applicative,       Monad,-      MonadReader (fe -> Bool),+      MonadReader (fe -> m Bool),       MonadError (HaltReason ue fe),       MonadWriter (Notes fe w)     )@@ -94,7 +94,7 @@  -- | Most flexible way to run a 'ConformT' runConformTFlexible ::-  (fe -> Bool) ->+  (fe -> m Bool) ->   ConformT ue fe w m a ->   m (Either (HaltReason ue fe) (a, Notes fe w)) runConformTFlexible predicate (ConformT func) = runExceptT (runWriterT (runReaderT func predicate))@@ -152,7 +152,7 @@   (fe -> Bool) ->   Conform ue fe w a ->   Either (HaltReason ue fe) (a, Notes fe w)-runConformFlexible predicate = runIdentity . runConformTFlexible predicate+runConformFlexible predicate = runIdentity . runConformTFlexible (Identity . predicate)  -- | Don't fix any fixable errors. --@@ -192,11 +192,11 @@       tell notes       pure (Just result) -fixAll :: fe -> Bool-fixAll = const True+fixAll :: Applicative m => fe -> m Bool+fixAll = const $ pure True -fixNone :: fe -> Bool-fixNone = const False+fixNone :: Applicative m => fe -> m Bool+fixNone = const $ pure False  conformFromEither :: Monad m => Either ue a -> ConformT ue fe w m a conformFromEither = \case@@ -246,7 +246,8 @@ emitFixableError :: Monad m => fe -> ConformT ue fe w m () emitFixableError fe = do   predicate <- ask-  if predicate fe+  fixThisError <- lift $ predicate fe+  if fixThisError     then tell (Notes [fe] [])     else throwError (HaltedBecauseOfStrictness fe)