Skip to content

Commit

Permalink
Putback MonadTrans instance for postcondition (#57)
Browse files Browse the repository at this point in the history
* Putback MonadTrans instance for postcondition

GHC's automatic derivation for PostconditionM's MonadTrans instance
introduces a redundant Monad constraint. In order to avoid that, we
do the derivation manually.

* Update quickcheck-dynamic/src/Test/QuickCheck/StateModel.hs

Co-authored-by: Ulf Norell <ulf.norell@gmail.com>

* Remove unneeded import

---------

Co-authored-by: Ulf Norell <ulf.norell@gmail.com>
  • Loading branch information
Arnaud Bailly and UlfNorell authored Sep 21, 2023
1 parent 5a5314b commit b9e4f8e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions quickcheck-dynamic/src/Test/QuickCheck/StateModel.hs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ type instance Realized Identity a = a
newtype PostconditionM m a = PostconditionM {runPost :: WriterT (Endo Property, Endo Property) m a}
deriving (Functor, Applicative, Monad)

instance MonadTrans PostconditionM where
lift = PostconditionM . lift

-- | Apply the property transformation to the property after evaluating
-- the postcondition. Useful for collecting statistics while avoiding
-- duplication between `monitoring` and `postcondition`.
Expand Down

0 comments on commit b9e4f8e

Please sign in to comment.