ideas-1.3.1: Feedback services for intelligent tutoring systems

Maintainerbastiaan.heeren@ou.nl
Stabilityprovisional
Portabilityportable (depends on ghc)
Safe HaskellSafe-Inferred
LanguageHaskell98

Ideas.Common.Strategy.Process

Contents

Description

Processes must support choices and sequences. This module defines a type class, an implementation, and utility functions.

Synopsis

IsProcess type class

class (Choice f, Sequence f) => IsProcess f where Source

Methods

toProcess :: f a -> Process a Source

Convert to the Process data type.

Process data type

data Process a Source

This datatype implements choices and sequences, but is slow for building sequences with the <*> combinator. See the Builder data type for a faster alternative.

menu :: Firsts s => s -> Menu (MenuItem (Elem s) s) Source

The menu offers single steps (with the remainder) and done steps.

eqProcessBy :: (a -> a -> Bool) -> Process a -> Process a -> Bool Source

Generalized equality of processes, which takes an equality function for the symbols.

Building sequences

data Builder a Source

The Builder data type offers a fast implementation for building sequences. The data type implements the IsProcess type class. A Builder value must be converted to a Process (with toProcess) it can be inspected in any way.

Query functions on a Process

ready :: Firsts s => s -> Bool Source

The ready predicate (we are done).

stopped :: Firsts s => s -> Bool Source

Not ready and no further steps to take.

firsts :: Firsts s => s -> [(Elem s, s)] Source

The first set.

Higher-order functions for iterating over a Process

fold :: Choice f => (a -> f b -> f b) -> f b -> Process a -> f b Source

Folding over a process takes a function for single steps and for done.

accum :: (a -> b -> [b]) -> b -> Process a -> Menu b Source

scan :: (s -> a -> [(s, b)]) -> s -> Process a -> Process b Source

prune :: (a -> Bool) -> Process a -> Process a Source