| Safe Haskell | Safe |
|---|
Control.Monad.MultiPass.Utils.InstanceTest
Contents
Description
For every new instrument, a number of class instances need to be
defined, such as NextGlobalContext and NextThreadContext. The
tests in this module are used to check that all the necessary
instances have been defined. Each test defines a trivial algorithm,
parameterised by an instrument of a specific arity. For example,
testInstrument3 is parameterised by a three-pass instrument. The
test is used as follows:
instanceTest :: ST2 r w () instanceTest = run instanceTestBody instanceTestBody :: TestInstrument3 (MyInstrument r w) r w instanceTestBody = testInstrument3
If this code does not cause any compiler errors, then all the
necessary instances have been defined for MyInstrument.
- testInstrument1 :: TestInstrument1 f r w
- type TestInstrument1 f r w = PassS (PassS (PassS PassZ)) (WrappedType1 f r w)
- testInstrument2 :: TestInstrument2 f r w
- type TestInstrument2 f r w = PassS (PassS (PassS (PassS PassZ))) (WrappedType2 f r w)
- testInstrument3 :: TestInstrument3 f r w
- type TestInstrument3 f r w = PassS (PassS (PassS (PassS (PassS (PassS PassZ))))) (WrappedType3 f r w)
- testInstrument4 :: TestInstrument4 f r w
- type TestInstrument4 f r w = PassS (PassS (PassS (PassS (PassS (PassS (PassS (PassS PassZ))))))) (WrappedType4 f r w)
Test for One-Pass Instruments
testInstrument1 :: TestInstrument1 f r wSource
Test function for a one-pass instrument.
type TestInstrument1 f r w = PassS (PassS (PassS PassZ)) (WrappedType1 f r w)Source
Test type for a one-pass instrument.
Test for Two-Pass Instruments
testInstrument2 :: TestInstrument2 f r wSource
Test function for a two-pass instrument.
type TestInstrument2 f r w = PassS (PassS (PassS (PassS PassZ))) (WrappedType2 f r w)Source
Test type for a two-pass instrument.
Test for Three-Pass Instruments
testInstrument3 :: TestInstrument3 f r wSource
Test function for a three-pass instrument.
type TestInstrument3 f r w = PassS (PassS (PassS (PassS (PassS (PassS PassZ))))) (WrappedType3 f r w)Source
Test type for a three-pass instrument.
Test for Four-Pass Instruments
testInstrument4 :: TestInstrument4 f r wSource
Test function for a four-pass instrument.