ideas-1.7: Feedback services for intelligent tutoring systems

Maintainer bastiaan.heeren@ou.nl provisional portable (depends on ghc) None Haskell98

Ideas.Common.Strategy.Abstract

Description

Abstract data type for a Strategy and a LabeledStrategy.

Synopsis

# Strategy data type

data Strategy a Source #

Abstract data type for strategies

Instances

 Source # MethodsapplyAll :: Strategy a -> a -> [a] Source # Source # MethodsliftView :: View a b -> Strategy b -> Strategy a Source #liftViewIn :: View a (b, c) -> Strategy b -> Strategy a Source # Source # Methods Show (Strategy a) Source # MethodsshowsPrec :: Int -> Strategy a -> ShowS #show :: Strategy a -> String #showList :: [Strategy a] -> ShowS # Fix (Strategy a) Source # Methodsfix :: (Strategy a -> Strategy a) -> Strategy a Source # Source # Methods(.|.) :: Strategy a -> Strategy a -> Strategy a Source #(./.) :: Strategy a -> Strategy a -> Strategy a Source #(|>) :: Strategy a -> Strategy a -> Strategy a Source #choice :: [Strategy a] -> Strategy a Source #preference :: [Strategy a] -> Strategy a Source #orelse :: [Strategy a] -> Strategy a Source # Source # Associated Typestype Sym (Strategy a) :: * Source # Methods(~>) :: Sym (Strategy a) -> Strategy a -> Strategy a Source #(.*.) :: Strategy a -> Strategy a -> Strategy a Source #single :: Sym (Strategy a) -> Strategy a Source #sequence :: [Strategy a] -> Strategy a Source # type Sym (Strategy a) Source # type Sym (Strategy a) = Rule a

# Labeled strategies

A strategy which is labeled with an identifier

Instances

 Source # MethodsapplyAll :: LabeledStrategy a -> a -> [a] Source # Source # MethodsliftView :: View a b -> LabeledStrategy b -> LabeledStrategy a Source #liftViewIn :: View a (b, c) -> LabeledStrategy b -> LabeledStrategy a Source # Source # Methods Source # MethodsshowList :: [LabeledStrategy a] -> ShowS # Source # MethodschangeId :: (Id -> Id) -> LabeledStrategy a -> LabeledStrategy a Source #

label :: (IsId l, IsStrategy f) => l -> f a -> LabeledStrategy a Source #

Labels a strategy with an identifier. Labels are used to identify substrategies and to specialize feedback messages. The first argument of label can be of type String, in which case the string is used as identifier (and not as description).

Removes the label from a strategy

# Lifting to strategies

class IsStrategy f where Source #

Type class to turn values into strategies

Minimal complete definition

toStrategy

Methods

toStrategy :: f a -> Strategy a Source #

Instances

 Source # Methods Source # Methods Source # Methods Source # Methods Source # Methods

liftS :: IsStrategy f => (Strategy a -> Strategy a) -> f a -> Strategy a Source #

liftS2 :: (IsStrategy f, IsStrategy g) => (Strategy a -> Strategy a -> Strategy a) -> f a -> g a -> Strategy a Source #

liftSn :: IsStrategy f => ([Strategy a] -> Strategy a) -> [f a] -> Strategy a Source #

# Prefixes

emptyPrefix :: IsStrategy f => f a -> a -> Prefix a Source #

Construct the empty prefix for a labeled strategy

replayPath :: IsStrategy f => Path -> f a -> a -> ([Rule a], Prefix a) Source #

Construct a prefix for a path and a labeled strategy. The third argument is the current term.

replayPaths :: IsStrategy f => [Path] -> f a -> a -> Prefix a Source #

Construct a prefix for a list of paths and a labeled strategy. The third argument is the current term.

replayStrategy :: (Monad m, IsStrategy f) => Path -> f a -> a -> m (a, Prefix a) Source #

Construct a prefix for a path and a labeled strategy. The third argument is the initial term.

# Rules

rulesInStrategy :: IsStrategy f => f a -> [Rule a] Source #

Returns a list of all major rules that are part of a labeled strategy

mapRules :: (Rule a -> Rule a) -> LabeledStrategy a -> LabeledStrategy a Source #

Apply a function to all the rules that make up a labeled strategy

mapRulesS :: (Rule a -> Rule a) -> Strategy a -> Strategy a Source #

cleanUpStrategy :: (a -> a) -> LabeledStrategy a -> LabeledStrategy a Source #

Use a function as do-after hook for all rules in a labeled strategy, but also use the function beforehand

cleanUpStrategyAfter :: (a -> a) -> LabeledStrategy a -> LabeledStrategy a Source #

Use a function as do-after hook for all rules in a labeled strategy

derivationList :: IsStrategy f => (Rule a -> Rule a -> Ordering) -> f a -> a -> [Derivation (Rule a, Environment) a] Source #