Control-Monad-MultiPass-0.1.0.0: A Library for Writing Multi-Pass Algorithms.

Safe HaskellSafe

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.

Synopsis

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.

type TestInstrument4 f r w = PassS (PassS (PassS (PassS (PassS (PassS (PassS (PassS PassZ))))))) (WrappedType4 f r w)Source

Test type for a four-pass instrument.