AERN-Net-0.2.1: Compositional lazy dataflow networks for exact real number computationSource codeContentsIndex
Control.ERNet.Blocks.Basic
Portabilityportable
Stabilityexperimental
Maintainermik@konecny.aow.cz
Description
Definitions of a few universaly useful simple network processes and process templates.
Synopsis
constantProcess :: (QAProtocol q a, Channel sIn sOut sInAnyProt sOutAnyProt) => ERProcessName -> (q -> a) -> ChannelType -> ERProcess sInAnyProt sOutAnyProt
constantChangedProcess :: (QAProtocol q a, Channel sIn sOut sInAnyProt sOutAnyProt) => ERProcessName -> (q -> a) -> ChannelType -> ERProcess sInAnyProt sOutAnyProt
constantStatefulProcess :: (QAProtocol q a, Channel sIn sOut sInAnyProt sOutAnyProt) => ERProcessName -> (s -> (QueryId, q) -> ((Bool, a), Maybe s)) -> s -> ChannelType -> ERProcess sInAnyProt sOutAnyProt
passThroughProcess :: (QAProtocol q1 a1, QAProtocol q2 a2, Channel sIn sOut sInAnyProt sOutAnyProt) => Bool -> ERProcessName -> (q1 -> q2) -> (q1 -> a2 -> a1) -> ChannelType -> ChannelType -> ERProcess sInAnyProt sOutAnyProt
maybePassThroughProcess :: (QAProtocol q1 a1, QAProtocol q2 a2, Channel sIn sOut sInAnyProt sOutAnyProt) => Bool -> ERProcessName -> (q1 -> Bool) -> (q1 -> a1) -> (q1 -> q2) -> (q1 -> a2 -> a1) -> ChannelType -> ChannelType -> ERProcess sInAnyProt sOutAnyProt
passThroughStatefulProcess :: (QAProtocol q1 a1, QAProtocol q2 a2, Channel sIn sOut sInAnyProt sOutAnyProt) => ERProcessName -> (s -> (QueryId, q1) -> (ERProcessAction s q2 a1, Maybe s)) -> (s -> (QueryId, q1) -> (q2, a2) -> (ERProcessAction s q2 a1, Maybe s)) -> s -> ChannelType -> ChannelType -> ERProcess sInAnyProt sOutAnyProt
passThroughBinaryStatefulProcess :: (QAProtocol q1 a1, QAProtocol q2 a2, QAProtocol q a, Channel sIn sOut sInAnyProt sOutAnyProt) => ERProcessName -> (s -> (QueryId, q) -> (ERProcessAction s (Maybe q1, Maybe q2) a, Maybe s)) -> (s -> (QueryId, q) -> (Maybe a1, Maybe a2) -> (ERProcessAction s (Maybe q1, Maybe q2) a, Maybe s)) -> s -> (ChannelType, ChannelType) -> ChannelType -> ERProcess sInAnyProt sOutAnyProt
passThroughBinaryProcess :: (QAProtocol q1 a1, QAProtocol q2 a2, QAProtocol q a, Channel sIn sOut sInAnyProt sOutAnyProt) => Bool -> ERProcessName -> (q -> (q1, q2)) -> (q -> (a1, a2) -> a) -> (ChannelType, ChannelType) -> ChannelType -> ERProcess sInAnyProt sOutAnyProt
rateProcess :: (QAProtocol q a, Channel sIn sOut sInAnyProt sOutAnyProt) => ERProcessName -> (a -> a -> Bool) -> Int -> ChannelType -> ERProcess sInAnyProt sOutAnyProt
precProcess :: (QAProtocol q a, Channel sIn sOut sInAnyProt sOutAnyProt) => Bool -> ERProcessName -> ChannelType -> a -> ERProcess sInAnyProt sOutAnyProt
Documentation
constantProcessSource
:: (QAProtocol q a, Channel sIn sOut sInAnyProt sOutAnyProt)
=> ERProcessNameprocess identifier (string)
-> q -> afunction to answer queries
-> ChannelTyperesult channel type
-> ERProcess sInAnyProt sOutAnyProt
A generic stateless process with no inputs.
constantChangedProcessSource
:: (QAProtocol q a, Channel sIn sOut sInAnyProt sOutAnyProt)
=> ERProcessNameprocess identifier (string)
-> q -> afunction to answer queries (without the ChTChanges wrapper)
-> ChannelTyperesult channel type
-> ERProcess sInAnyProt sOutAnyProt
A generic process with no inputs that answers using a ChTChanges protocol.
constantStatefulProcessSource
:: (QAProtocol q a, Channel sIn sOut sInAnyProt sOutAnyProt)
=> ERProcessNameprocess identifier (string)
-> s -> (QueryId, q) -> ((Bool, a), Maybe s)function to answer queries and transform state
-> sinitial state
-> ChannelTyperesult channel type
-> ERProcess sInAnyProt sOutAnyProt
A generic stateful process with no inputs.
passThroughProcessSource
:: (QAProtocol q1 a1, QAProtocol q2 a2, Channel sIn sOut sInAnyProt sOutAnyProt)
=> Boolshould use channel cache?
-> ERProcessName
-> q1 -> q2query translator
-> q1 -> a2 -> a1answer translator
-> ChannelTypeargument channel type
-> ChannelTyperesult channel type
-> ERProcess sInAnyProt sOutAnyProt
A simple process that passes on a translated version of each query to another process and translates the answers before passing them back.
maybePassThroughProcessSource
:: (QAProtocol q1 a1, QAProtocol q2 a2, Channel sIn sOut sInAnyProt sOutAnyProt)
=> Boolshould use channel cache?
-> ERProcessName
-> q1 -> Boolif True, query should NOT be passed on
-> q1 -> a1responder to use if not passing queries on
-> q1 -> q2translator for queries to pass on
-> q1 -> a2 -> a1translator for passed answers
-> ChannelTypeinput channel type
-> ChannelTypeoutput channel type
-> ERProcess sInAnyProt sOutAnyProt
A simple process that either responds with no further queries or passes on a translated version of the query to another process, and then passing back a translated version of the answer received.
passThroughStatefulProcessSource
:: (QAProtocol q1 a1, QAProtocol q2 a2, Channel sIn sOut sInAnyProt sOutAnyProt)
=> ERProcessName
-> s -> (QueryId, q1) -> (ERProcessAction s q2 a1, Maybe s)what to do with a query + forward or reply
-> s -> (QueryId, q1) -> (q2, a2) -> (ERProcessAction s q2 a1, Maybe s)what to do with an answer - another query or reply
-> sinitial state
-> ChannelTypeargument channel type
-> ChannelTyperesult channel type
-> ERProcess sInAnyProt sOutAnyProt

A process with one input and one output socket. Upon receiving a query or an answer related to a previously received query, the process uses the provided functions to decide whether to answer the query, make a new query or wait until the state meets a certain condition. When the condition is met, the event (query or answer) in question is processed again using the same function.

Several simpler processes are defined as specialisations of this one.

passThroughBinaryStatefulProcessSource
:: (QAProtocol q1 a1, QAProtocol q2 a2, QAProtocol q a, Channel sIn sOut sInAnyProt sOutAnyProt)
=> ERProcessName
-> s -> (QueryId, q) -> (ERProcessAction s (Maybe q1, Maybe q2) a, Maybe s)what to do with a query + forward or reply
-> s -> (QueryId, q) -> (Maybe a1, Maybe a2) -> (ERProcessAction s (Maybe q1, Maybe q2) a, Maybe s)what to do with an answer - another query or reply
-> sinitial state
-> (ChannelType, ChannelType)argument channels types
-> ChannelTyperesult channel type
-> ERProcess sInAnyProt sOutAnyProt
A process that passes on a translated version of each query to one or both of another 2 channels. When the other channel(s) answer, it analyses the answer(s) and decides whether to send other queries or answer its original query.
passThroughBinaryProcessSource
:: (QAProtocol q1 a1, QAProtocol q2 a2, QAProtocol q a, Channel sIn sOut sInAnyProt sOutAnyProt)
=> Boolshould use channel cache?
-> ERProcessName
-> q -> (q1, q2)query translator
-> q -> (a1, a2) -> aanswer translator
-> (ChannelType, ChannelType)argument channels types
-> ChannelTyperesult channel type
-> ERProcess sInAnyProt sOutAnyProt
A simple process that passes on a translated version of each query to another process and translates the answers before passing them back.
rateProcessSource
:: (QAProtocol q a, Channel sIn sOut sInAnyProt sOutAnyProt)
=> ERProcessNameprocess identifier (string)
-> a -> a -> Boolfunction to judge whether the improvement is good enough
-> Intmaximum number of attempts to reach desired improvement
-> ChannelTypenumber channel type
-> ERProcess sInAnyProt sOutAnyProt

A process passing on information without modification, except for improving the convergence rate in successive queries.

Each query may refer to a previous query. When it does, the query will not be answered until either:

  • the answer has improved sufficiently since last time one was given
  • the number of queries made in response to this query has reached the given limit

Currently supports only single-threaded querying.

precProcessSource
:: (QAProtocol q a, Channel sIn sOut sInAnyProt sOutAnyProt)
=> Boolshould use channel cache?
-> ERProcessName
-> ChannelTypein, out channel type
-> asample answer (without QAIxA) to identify protocol type
-> ERProcess sInAnyProt sOutAnyProt

A trivial passthrough process that only:

  • reduces prec by 1 in all queries
  • ensures that the granularity of all answers is raised to prec
Produced by Haddock version 2.4.2