Module

Perspectives.Query.Compiler

The QueryCompiler constructs functions to calculate an instance of a Role for a Context or a Value for a Property, from a QueryFunctionDescription. It operates on a Variant CompiledFunction that covers all combinations of Domain and Range that can be computed. Instances of QueryFunctionDescription are computed by the function compileQueryStep.

#compileFunction

compileFunction :: QueryFunctionDescription -> MP CompiledFunction

Construct a function wrapped in CompiledFunction that actually computes the described function. A note on kind of roles (RoleKind). In the type representation, we keep UserRoles, BotRoles, etc. in seperate members of Context. But in the instance representation, there is no need for that. All (Enumerated) roles have the same runtime representation and their names are unique.

#getRoleFunction

getRoleFunction :: String -> MonadPerspectives (ContextInstance ~~> RoleInstance)

From a string that maybe identifies a Role, retrieve or construct a function to get that role from a Context instance. Notice that this function may fail.

#context2context

context2context :: QueryFunctionDescription -> MP (ContextInstance ~~> ContextInstance)

Construct a function to compute instances of a ContextType from an instance of a Context.

#context2role

context2role :: QueryFunctionDescription -> MP (ContextInstance ~~> RoleInstance)

Construct a function to compute instances of a RoleType from an instance of a Context.

#context2propertyValue

context2propertyValue :: QueryFunctionDescription -> MP (ContextInstance ~~> Value)

Construct a function to compute values of a Property for some RoleType from an instance of a Context.

Modules