Skip to content

Commit 568b51e

Browse files
Remove ActionResult constraint
1 parent 9aa0f67 commit 568b51e

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

quickcheck-dynamic/src/Test/QuickCheck/DynamicLogic.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ module Test.QuickCheck.DynamicLogic (
3737

3838
import Control.Applicative
3939
import Control.Monad
40+
import Data.Typeable
4041
import Test.QuickCheck hiding (getSize)
4142
import Test.QuickCheck.DynamicLogic.Core qualified as DL
4243
import Test.QuickCheck.DynamicLogic.Quantify
@@ -63,7 +64,7 @@ instance Monad (DL s) where
6364
instance MonadFail (DL s) where
6465
fail = errorDL
6566

66-
action :: (ActionResult a, Eq (Action s a)) => Action s a -> DL s ()
67+
action :: (Typeable a, Eq (Action s a)) => Action s a -> DL s ()
6768
action cmd = DL $ \_ k -> DL.after cmd $ k ()
6869

6970
anyAction :: DL s ()

quickcheck-dynamic/src/Test/QuickCheck/DynamicLogic/Core.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ afterAny :: (s -> DynFormula s) -> DynFormula s
9595
-- | Given `f` must be `True` after /some/ action.
9696
-- `f` is passed the state resulting from executing the `Action`.
9797
after ::
98-
(ActionResult a, Eq (Action s a)) =>
98+
(Typeable a, Eq (Action s a)) =>
9999
Action s a ->
100100
(s -> DynFormula s) ->
101101
DynFormula s

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

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ module Test.QuickCheck.StateModel (
3030
pattern Actions,
3131
EnvEntry (..),
3232
Env,
33-
ActionResult,
3433
Realized,
3534
stateAfter,
3635
runActions,
@@ -106,7 +105,7 @@ class
106105
-- | Shrinker for `Action`.
107106
-- Defaults to no-op but as usual, defining a good shrinker greatly enhances the usefulness
108107
-- of property-based testing.
109-
shrinkAction :: ActionResult a => state -> Action state a -> [Any (Action state)]
108+
shrinkAction :: Typeable a => state -> Action state a -> [Any (Action state)]
110109
shrinkAction _ _ = []
111110

112111
-- | Initial state of generated traces.
@@ -144,7 +143,7 @@ class Monad m => RunModel state m where
144143
--
145144
-- The `Lookup` parameter provides an /environment/ to lookup `Var
146145
-- a` instances from previous steps.
147-
perform :: forall a. ActionResult a => state -> Action state a -> LookUp m -> m (Realized m a)
146+
perform :: forall a. Typeable a => state -> Action state a -> LookUp m -> m (Realized m a)
148147
-- | Postcondition on the `a` value produced at some step.
149148
-- The result is `assert`ed and will make the property fail should it be `False`. This is useful
150149
-- to check the implementation produces expected values.
@@ -163,7 +162,7 @@ type LookUp m = forall a. Typeable a => Var a -> Realized m a
163162
type Env m = [EnvEntry m]
164163

165164
data EnvEntry m where
166-
(:==) :: ActionResult a => Var a -> Realized m a -> EnvEntry m
165+
(:==) :: Typeable a => Var a -> Realized m a -> EnvEntry m
167166

168167
infix 5 :==
169168

@@ -179,10 +178,8 @@ lookUpVar env v = case lookUpVarMaybe env v of
179178
Nothing -> error $ "Variable " ++ show v ++ " is not bound!"
180179
Just a -> a
181180

182-
type ActionResult a = Typeable a
183-
184181
data Any f where
185-
Some :: (ActionResult a, Eq (f a)) => f a -> Any f
182+
Some :: (Typeable a, Eq (f a)) => f a -> Any f
186183
Error :: String -> Any f
187184

188185
deriving instance (forall a. Show (Action state a)) => Show (Any (Action state))
@@ -197,7 +194,7 @@ instance Eq (Any f) where
197194

198195
data Step state where
199196
(:=) ::
200-
(ActionResult a, Eq (Action state a), Show (Action state a)) =>
197+
(Typeable a, Eq (Action state a), Show (Action state a)) =>
201198
Var a ->
202199
Action state a ->
203200
Step state

0 commit comments

Comments
 (0)