Copyright | (C) 2017 ATS Advanced Telematic Systems GmbH |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | Stevan Andjelkovic <stevan@advancedtelematic.com> |
Stability | provisional |
Portability | non-portable (GHC extensions) |
Safe Haskell | None |
Language | Haskell2010 |
This module contains the main types exposed to the user. The module is perhaps best read indirectly, on a per need basis, via the main module Test.StateMachine.
- data StateMachineModel model cmd = StateMachineModel {
- precondition :: forall refs resp. IxForallF Ord refs => model refs -> cmd refs resp -> Bool
- postcondition :: forall refs resp. IxForallF Ord refs => model refs -> cmd refs resp -> Response_ refs resp -> Property
- transition :: forall refs resp. IxForallF Ord refs => model refs -> cmd refs resp -> Response_ refs resp -> model refs
- initialModel :: forall refs. model refs
- class ShowCmd cmd where
- showCmd :: forall resp. ShowCmd cmd => cmd (ConstSym1 String) resp -> String
- type Signature ix = (TyFun ix Type -> Type) -> Response ix -> Type
- data Response ix
- data SResponse ix :: Response ix -> Type where
- type family Response_ (refs :: TyFun ix Type -> Type) (resp :: Response ix) :: Type where ...
- type family GetResponse_ (resp :: Response ix) :: k where ...
- class HasResponse cmd where
- response :: HasResponse cmd => cmd refs resp -> SResponse ix resp
- type CommandConstraint ix cmd = (Ord ix, SDecide ix, SingKind ix, DemoteRep ix ~ ix, ShowCmd cmd, IxTraversable cmd, HasResponse cmd)
- data Untyped f refs where
- Untyped :: (Show (GetResponse_ resp), Typeable (Response_ ConstIntRef resp), Typeable resp) => f refs resp -> Untyped f refs
- data RefPlaceholder ix :: TyFun ix k -> Type
- data Ex p = Ex (Sing x) (p @@ x)
- class IxFunctor f where
- ifmap :: forall p q j. IxFunctor f => (forall i. Sing (i :: ix) -> (p @@ i) -> q @@ i) -> f p j -> f q j
- class IxFoldable t where
- ifoldMap :: (IxFoldable t, Monoid m) => (forall i. Sing (i :: ix) -> (p @@ i) -> m) -> t p j -> m
- itoList :: IxFoldable t => t p j -> [Ex p]
- iany :: IxFoldable t => (forall i. Sing (i :: ix) -> (p @@ i) -> Bool) -> t p j -> Bool
- class (IxFunctor t, IxFoldable t) => IxTraversable t where
- itraverse :: (IxTraversable t, Applicative f) => Proxy q -> (forall x. Sing x -> (p @@ x) -> f (q @@ x)) -> t p j -> f (t q j)
- ifor :: (IxTraversable t, Applicative f) => Proxy q -> t p j -> (forall x. Sing x -> (p @@ x) -> f (q @@ x)) -> f (t q j)
- class Forall (IxComposeC p f) => IxForallF p f
- type Ords refs = IxForallF Ord refs :- Ord (refs @@ ())
- type Ords' refs i = IxForallF Ord refs :- Ord (refs @@ i)
- iinstF :: forall a p f. Proxy a -> IxForallF p f :- p (f @@ a)
- (\\) :: a => (b -> r) -> (:-) a b -> r
- type (@@) k1 k2 a b = Apply k1 k2 a b
- data Property :: *
- property :: Testable prop => prop -> Property
- data Proxy k t :: forall k. k -> * = Proxy
Documentation
data StateMachineModel model cmd Source #
A state machine based model.
StateMachineModel | |
|
showCmd :: forall resp. ShowCmd cmd => cmd (ConstSym1 String) resp -> String Source #
How to show a typed command with internal refereces.
type Signature ix = (TyFun ix Type -> Type) -> Response ix -> Type Source #
Signatures of commands contain a family of references and a response type.
A response of a command is either of some type or a referece at some index.
type family Response_ (refs :: TyFun ix Type -> Type) (resp :: Response ix) :: Type where ... Source #
Type-level function that returns a response type.
type family GetResponse_ (resp :: Response ix) :: k where ... Source #
Type-level function that maybe returns a response.
GetResponse_ (Response t) = t | |
GetResponse_ (Reference i) = () |
class HasResponse cmd where Source #
Given a command, what kind of response does it have?
response :: HasResponse cmd => cmd refs resp -> SResponse ix resp Source #
What type of response a typed command has.
type CommandConstraint ix cmd = (Ord ix, SDecide ix, SingKind ix, DemoteRep ix ~ ix, ShowCmd cmd, IxTraversable cmd, HasResponse cmd) Source #
The constraints on commands (and their indices) that the
sequentialProperty
and
parallelProperty
helpers require.
data Untyped f refs where Source #
Untyped commands are command where we hide the response type. This is used in generation of commands.
Untyped :: (Show (GetResponse_ resp), Typeable (Response_ ConstIntRef resp), Typeable resp) => f refs resp -> Untyped f refs |
data RefPlaceholder ix :: TyFun ix k -> Type Source #
When generating commands it is enough to provide a reference placeholder.
Indexed variant of Functor
, Foldable
and Traversable
.
ifmap :: forall p q j. IxFunctor f => (forall i. Sing (i :: ix) -> (p @@ i) -> q @@ i) -> f p j -> f q j Source #
Indexed fmap
.
class IxFoldable t where Source #
Foldable for predicate transformers.
ifoldMap :: (IxFoldable t, Monoid m) => (forall i. Sing (i :: ix) -> (p @@ i) -> m) -> t p j -> m Source #
Indexed foldMap
.
itoList :: IxFoldable t => t p j -> [Ex p] Source #
Indexed toList
.
iany :: IxFoldable t => (forall i. Sing (i :: ix) -> (p @@ i) -> Bool) -> t p j -> Bool Source #
Indexed any
.
class (IxFunctor t, IxFoldable t) => IxTraversable t where Source #
Tranversable for predicate transformers.
itraverse :: (IxTraversable t, Applicative f) => Proxy q -> (forall x. Sing x -> (p @@ x) -> f (q @@ x)) -> t p j -> f (t q j) Source #
Indexed traverse function.
ifor :: (IxTraversable t, Applicative f) => Proxy q -> t p j -> (forall x. Sing x -> (p @@ x) -> f (q @@ x)) -> f (t q j) Source #
Same as above, with arguments flipped.
Indexed variants of some constraints
package combinators.
type Ords refs = IxForallF Ord refs :- Ord (refs @@ ()) Source #
Type alias that is helpful when defining state machine models.
Re-export
(\\) :: a => (b -> r) -> (:-) a b -> r infixl 1 #
Given that a :- b
, derive something that needs a context b
, using the context a
data Proxy k t :: forall k. k -> * #
A concrete, poly-kinded proxy type
Monad (Proxy *) | |
Functor (Proxy *) | |
Applicative (Proxy *) | |
Foldable (Proxy *) | |
Traversable (Proxy *) | |
Generic1 (Proxy *) | |
Eq1 (Proxy *) | Since: 4.9.0.0 |
Ord1 (Proxy *) | Since: 4.9.0.0 |
Read1 (Proxy *) | Since: 4.9.0.0 |
Show1 (Proxy *) | Since: 4.9.0.0 |
Alternative (Proxy *) | |
MonadPlus (Proxy *) | |
Bounded (Proxy k s) | |
Enum (Proxy k s) | |
Eq (Proxy k s) | |
Ord (Proxy k s) | |
Read (Proxy k s) | |
Show (Proxy k s) | |
Ix (Proxy k s) | |
Generic (Proxy k t) | |
Semigroup (Proxy k s) | |
Monoid (Proxy k s) | |
type Rep1 (Proxy *) | |
type Rep (Proxy k t) | |