@@ -30,7 +30,6 @@ module Test.QuickCheck.StateModel (
30
30
pattern Actions ,
31
31
EnvEntry (.. ),
32
32
Env ,
33
- ActionResult ,
34
33
Realized ,
35
34
stateAfter ,
36
35
runActions ,
@@ -106,7 +105,7 @@ class
106
105
-- | Shrinker for `Action`.
107
106
-- Defaults to no-op but as usual, defining a good shrinker greatly enhances the usefulness
108
107
-- 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 )]
110
109
shrinkAction _ _ = []
111
110
112
111
-- | Initial state of generated traces.
@@ -144,7 +143,7 @@ class Monad m => RunModel state m where
144
143
--
145
144
-- The `Lookup` parameter provides an /environment/ to lookup `Var
146
145
-- 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 )
148
147
-- | Postcondition on the `a` value produced at some step.
149
148
-- The result is `assert`ed and will make the property fail should it be `False`. This is useful
150
149
-- to check the implementation produces expected values.
@@ -163,7 +162,7 @@ type LookUp m = forall a. Typeable a => Var a -> Realized m a
163
162
type Env m = [EnvEntry m ]
164
163
165
164
data EnvEntry m where
166
- (:==) :: ActionResult a => Var a -> Realized m a -> EnvEntry m
165
+ (:==) :: Typeable a => Var a -> Realized m a -> EnvEntry m
167
166
168
167
infix 5 :==
169
168
@@ -179,10 +178,8 @@ lookUpVar env v = case lookUpVarMaybe env v of
179
178
Nothing -> error $ " Variable " ++ show v ++ " is not bound!"
180
179
Just a -> a
181
180
182
- type ActionResult a = Typeable a
183
-
184
181
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
186
183
Error :: String -> Any f
187
184
188
185
deriving instance (forall a . Show (Action state a )) => Show (Any (Action state ))
@@ -197,7 +194,7 @@ instance Eq (Any f) where
197
194
198
195
data Step state where
199
196
(:=) ::
200
- (ActionResult a , Eq (Action state a ), Show (Action state a )) =>
197
+ (Typeable a , Eq (Action state a ), Show (Action state a )) =>
201
198
Var a ->
202
199
Action state a ->
203
200
Step state
0 commit comments