Portability | portable |
---|---|
Stability | experimental |
Maintainer | mik@konecny.aow.cz |
This module defines the concept of a protocol for channel communication.
The protocol concept is formalised using the 2-parameter class
QAProtocol
and the existential types
ChannelType
, AnswerAnyProt
, QueryAnyProt
indexed by instances of QAProtocol
.
- type QueryId = Int
- class (Ord q, HTML q, HTML a, Show q, Show a, Typeable q, Typeable a) => QAProtocol q a | a -> q, q -> a where
- qaMatch :: q -> a -> Maybe String
- qaaSetMinGran :: Granularity -> a -> a
- data ChannelType = forall q a . (QAProtocol q a, Eq q, Show q, Eq a, Show a) => ChannelType q a
- data QueryAnyProt = forall q a . (QAProtocol q a, Show q, Show a) => QueryAnyProt q
- data AnswerAnyProt = forall q a . (QAProtocol q a, Show q, Show a) => AnswerAnyProt a
- data QAUnitQ = QAUnitQ
- data QAUnitA = QAUnitA
- data QABoolQ = QABoolQ
- data QANatQ = QANatQ
- data QANatA = QANatA Integer
Documentation
class (Ord q, HTML q, HTML a, Show q, Show a, Typeable q, Typeable a) => QAProtocol q a | a -> q, q -> a whereSource
A class grouping types of queries and answers.
Each instance has to define dynamic type checking of answers agains queries.
test whether the answer makes sense for a given query (dynamic type checking)
qaaSetMinGran :: Granularity -> a -> aSource
QAProtocol QANatQ QANatA | |
QAProtocol QABoolQ Bool | |
QAProtocol QAUnitQ QAUnitA | |
QAProtocol QALFTRealQ QALFTRealA | |
(ERApproxElementary ira, Typeable ira) => QAProtocol QARealQ (QARealA ira) | |
(QAProtocol q a, Show q, Show a) => QAProtocol (QAListQ q) (QAListA a) | |
(QAProtocol q a, Show q, Show a) => QAProtocol (QAChangesQ q) (QAChangesA a) | |
QAProtocol q a => QAProtocol (QAIxQ q) (QAIxA a) | |
(QAProtocol q a, Show q, Show a) => QAProtocol (QAMaybeQ q) (QAMaybeA a) | |
(ERFnApprox box varid domra ranra fa, Typeable fa, HTML fa) => QAProtocol (QAFn2Q fa) (QAFn2A fa) | |
(ERFnApprox box varid domra ranra fa, ERApproxElementary domra, ERApproxElementary ranra, Typeable box, Show box, Typeable domra, Typeable ranra, Typeable fa, HTML fa) => QAProtocol (QAFn1Q box) (QAFn1A ranra fa) | |
(QAProtocol q1 a1, QAProtocol q2 a2, Show q1, Show a1, Show q2, Show a2) => QAProtocol (QAProdQ q1 q2) (QAProdA a1 a2) |
data ChannelType Source
This type is used to identify protocols eg for the creation of new channels or for dynamic type checking. It consists of an example query and an example answer.
forall q a . (QAProtocol q a, Eq q, Show q, Eq a, Show a) => ChannelType q a |
data QueryAnyProt Source
Union of queries from all protocols.
forall q a . (QAProtocol q a, Show q, Show a) => QueryAnyProt q |
data AnswerAnyProt Source
Union of answers from all protocols.
forall q a . (QAProtocol q a, Show q, Show a) => AnswerAnyProt a |