| Safe Haskell | None |
|---|
Test.IOTasks.Specification
Synopsis
- data Specification
- readInput :: (Typeable a, Read a, Show a) => Var a -> ValueSet a -> InputMode -> Specification
- writeOutput :: forall (k :: PatternKind). [OutputPattern k] -> Specification
- writeOptionalOutput :: forall (k :: PatternKind). [OutputPattern k] -> Specification
- anyOptionalOutput :: Specification
- branch :: Term 'Transparent Bool -> Specification -> Specification -> Specification
- tillExit :: Specification -> Specification
- exit :: Specification
- while :: Term 'Transparent Bool -> Specification -> Specification
- whileNot :: Term 'Transparent Bool -> Specification -> Specification
- repeatUntil :: Specification -> Term 'Transparent Bool -> Specification
- doWhile :: Specification -> Term 'Transparent Bool -> Specification
- nop :: Specification
- runSpecification :: Specification -> [String] -> (AbstractTrace, OverflowWarning)
- runSpecification' :: AddLinebreaks -> Specification -> [String] -> (AbstractTrace, OverflowWarning)
- type AddLinebreaks = Bool
- readVars :: Specification -> [SomeVar]
- hasIteration :: Specification -> Bool
- pPrintSpecification :: Specification -> Doc
- data InputMode
- accept :: Specification -> Trace -> Bool
- data LoopBody = LoopBody {}
Documentation
data Specification Source #
Instances
readInput :: (Typeable a, Read a, Show a) => Var a -> ValueSet a -> InputMode -> Specification Source #
writeOutput :: forall (k :: PatternKind). [OutputPattern k] -> Specification Source #
writeOptionalOutput :: forall (k :: PatternKind). [OutputPattern k] -> Specification Source #
anyOptionalOutput :: Specification Source #
The anyOptionalOutput function represents a specification for writing
arbitrary optional output. The output can be anything, as indicated by the
use of the wildcard pattern in its definition:
anyOptionalOutput = writeOptionalOutput [wildcard]
branch :: Term 'Transparent Bool -> Specification -> Specification -> Specification Source #
Represents a branching structure in a specification.
- The first
Specificationargument is the "then-case". - The second
Specificationargument is the "else-case".
exit :: Specification Source #
while :: Term 'Transparent Bool -> Specification -> Specification Source #
Represents a loop structure in a specification, performing the body while the condition holds.
The while function takes a condition and a body specification, and constructs a loop structure where:
- The
Term'TransparentBoolargument is the condition to be evaluated at the beginning of each iteration. The loop continues as long as the condition isTrue. - The
Specificationargument is the body of the loop, executed while the condition isTrue.
The function assumes that the body specification does not contain a top-level exit marker.
while c bdy = tillExit (branch c bdy exit)
whileNot :: Term 'Transparent Bool -> Specification -> Specification Source #
Represents a loop structure in a specification, performing the body while the condition does not hold.
The whileNot function takes a condition and a body specification, and constructs a loop structure where:
- The
Term'TransparentBoolargument is the condition to be evaluated at the beginning of each iteration. The loop continues as long as the condition isFalse. - The
Specificationargument is the body of the loop, executed while the condition isFalse.
The function assumes that the body specification does not contain a top-level exit marker.
whileNot c bdy = tillExit (branch c exit bdy)
repeatUntil :: Specification -> Term 'Transparent Bool -> Specification Source #
Represents a loop structure in a specification, performing the body at least once and then further while the condition does not hold.
The repeatUntil function takes a body specification and a condition, and constructs a loop structure where:
- The
Specificationargument is the body of the loop, executed at least once and then further times while the condition isFalse. - The
Term'TransparentBoolargument is the condition to be evaluated at the end of each iteration. The loop continues until the condition becomesTrue.
The function assumes that the body specification does not contain a top-level exit marker.
repeatUntil bdy c = tillExit (bdy <> branch c exit nop)
doWhile :: Specification -> Term 'Transparent Bool -> Specification Source #
Represents a loop structure in a specification, performing the body at least once and then further while the condition holds.
The doWhile function takes a body specification and a condition, and constructs a loop structure where:
- The
Specificationargument is the body of the loop, executed at least once and then further times while the condition isTrue. - The
Term'TransparentBoolargument is the condition to be evaluated at the end of each iteration. The loop continues until the condition becomesFalse.
The function assumes that the body specification does not contain a top-level exit marker.
doWhile bdy c = tillExit (bdy <> branch c nop exit)
nop :: Specification Source #
runSpecification :: Specification -> [String] -> (AbstractTrace, OverflowWarning) Source #
runSpecification' :: AddLinebreaks -> Specification -> [String] -> (AbstractTrace, OverflowWarning) Source #
type AddLinebreaks = Bool Source #
readVars :: Specification -> [SomeVar] Source #
hasIteration :: Specification -> Bool Source #
pPrintSpecification :: Specification -> Doc Source #
Constructors
| AssumeValid | |
| UntilValid | |
| ElseAbort |
accept :: Specification -> Trace -> Bool Source #