ideas-1.6: Feedback services for intelligent tutoring systems

Maintainerbastiaan.heeren@ou.nl
Stabilityprovisional
Portabilityportable (depends on ghc)
Safe HaskellNone
LanguageHaskell98

Ideas.Encoding.Encoder

Contents

Description

 

Synopsis

Converter type class

class Converter f where Source #

Minimal complete definition

fromExercise, fromOptions, run

Methods

fromExercise :: (Exercise a -> t) -> f a s t Source #

fromOptions :: (Options -> t) -> f a s t Source #

run :: Monad m => f a s t -> Exercise a -> Options -> s -> m t Source #

Instances

Converter Decoder Source # 

Methods

fromExercise :: (Exercise a -> t) -> Decoder a s t Source #

fromOptions :: (Options -> t) -> Decoder a s t Source #

run :: Monad m => Decoder a s t -> Exercise a -> Options -> s -> m t Source #

Converter Encoder Source # 

Methods

fromExercise :: (Exercise a -> t) -> Encoder a s t Source #

fromOptions :: (Options -> t) -> Encoder a s t Source #

run :: Monad m => Encoder a s t -> Exercise a -> Options -> s -> m t Source #

withExercise :: (Converter f, Monad (f a s)) => (Exercise a -> f a s t) -> f a s t Source #

withOpenMath :: (Converter f, Monad (f a s)) => (Bool -> f a s t) -> f a s t Source #

withJSONTerm :: (Converter f, Monad (f a s)) => (Bool -> f a s t) -> f a s t Source #

(//) :: (Converter f, Monad (f a s2)) => f a s t -> s -> f a s2 t Source #

JSON support

Latex support

latexPrinter :: Exercise a -> a -> Latex Source #

Uses exercise pretty-printer in case latex encoding is missing.

latexPrinterContext :: Exercise a -> Context a -> Latex Source #

Uses exercise pretty-printer in case latex encoding is missing.

Encoder datatype

data Encoder a s t Source #

Instances

Converter Encoder Source # 

Methods

fromExercise :: (Exercise a -> t) -> Encoder a s t Source #

fromOptions :: (Options -> t) -> Encoder a s t Source #

run :: Monad m => Encoder a s t -> Exercise a -> Options -> s -> m t Source #

Arrow (Encoder a) Source # 

Methods

arr :: (b -> c) -> Encoder a b c #

first :: Encoder a b c -> Encoder a (b, d) (c, d) #

second :: Encoder a b c -> Encoder a (d, b) (d, c) #

(***) :: Encoder a b c -> Encoder a b' c' -> Encoder a (b, b') (c, c') #

(&&&) :: Encoder a b c -> Encoder a b c' -> Encoder a b (c, c') #

Category * (Encoder a) Source # 

Methods

id :: cat a a #

(.) :: cat b c -> cat a b -> cat a c #

Monad (Encoder a s) Source # 

Methods

(>>=) :: Encoder a s a -> (a -> Encoder a s b) -> Encoder a s b #

(>>) :: Encoder a s a -> Encoder a s b -> Encoder a s b #

return :: a -> Encoder a s a #

fail :: String -> Encoder a s a #

Functor (Encoder a s) Source # 

Methods

fmap :: (a -> b) -> Encoder a s a -> Encoder a s b #

(<$) :: a -> Encoder a s b -> Encoder a s a #

Applicative (Encoder a s) Source # 

Methods

pure :: a -> Encoder a s a #

(<*>) :: Encoder a s (a -> b) -> Encoder a s a -> Encoder a s b #

(*>) :: Encoder a s a -> Encoder a s b -> Encoder a s b #

(<*) :: Encoder a s a -> Encoder a s b -> Encoder a s a #

Alternative (Encoder a s) Source # 

Methods

empty :: Encoder a s a #

(<|>) :: Encoder a s a -> Encoder a s a -> Encoder a s a #

some :: Encoder a s a -> Encoder a s [a] #

many :: Encoder a s a -> Encoder a s [a] #

MonadPlus (Encoder a s) Source # 

Methods

mzero :: Encoder a s a #

mplus :: Encoder a s a -> Encoder a s a -> Encoder a s a #

Monoid t => Monoid (Encoder a s t) Source # 

Methods

mempty :: Encoder a s t #

mappend :: Encoder a s t -> Encoder a s t -> Encoder a s t #

mconcat :: [Encoder a s t] -> Encoder a s t #

BuildXML t => BuildXML (Encoder a s t) Source # 

Methods

(.=.) :: String -> String -> Encoder a s t Source #

unescaped :: String -> Encoder a s t Source #

builder :: Element -> Encoder a s t Source #

tag :: String -> Encoder a s t -> Encoder a s t Source #

string :: String -> Encoder a s t Source #

text :: Show s => s -> Encoder a s t Source #

element :: String -> [Encoder a s t] -> Encoder a s t Source #

emptyTag :: String -> Encoder a s t Source #

makeEncoder :: (s -> t) -> Encoder a s t Source #

encoderFor :: (s -> Encoder a s t) -> Encoder a s t Source #

exerciseEncoder :: (Exercise a -> s -> t) -> Encoder a s t Source #

(<?>) :: (Encoder a t b, Type a1 t) -> Encoder a (TypedValue (Type a1)) b -> Encoder a (TypedValue (Type a1)) b infixr 5 Source #

encodeTyped :: Encoder st t b -> Type a t -> Encoder st (TypedValue (Type a)) b Source #

Decoder datatype

data Decoder a s t Source #

Instances

Converter Decoder Source # 

Methods

fromExercise :: (Exercise a -> t) -> Decoder a s t Source #

fromOptions :: (Options -> t) -> Decoder a s t Source #

run :: Monad m => Decoder a s t -> Exercise a -> Options -> s -> m t Source #

Monad (Decoder a s) Source # 

Methods

(>>=) :: Decoder a s a -> (a -> Decoder a s b) -> Decoder a s b #

(>>) :: Decoder a s a -> Decoder a s b -> Decoder a s b #

return :: a -> Decoder a s a #

fail :: String -> Decoder a s a #

Functor (Decoder a s) Source # 

Methods

fmap :: (a -> b) -> Decoder a s a -> Decoder a s b #

(<$) :: a -> Decoder a s b -> Decoder a s a #

Applicative (Decoder a s) Source # 

Methods

pure :: a -> Decoder a s a #

(<*>) :: Decoder a s (a -> b) -> Decoder a s a -> Decoder a s b #

(*>) :: Decoder a s a -> Decoder a s b -> Decoder a s b #

(<*) :: Decoder a s a -> Decoder a s b -> Decoder a s a #

Alternative (Decoder a s) Source # 

Methods

empty :: Decoder a s a #

(<|>) :: Decoder a s a -> Decoder a s a -> Decoder a s a #

some :: Decoder a s a -> Decoder a s [a] #

many :: Decoder a s a -> Decoder a s [a] #

MonadPlus (Decoder a s) Source # 

Methods

mzero :: Decoder a s a #

mplus :: Decoder a s a -> Decoder a s a -> Decoder a s a #

type TypedDecoder a s = forall t. Type a t -> Decoder a s t Source #

makeDecoder :: (s -> t) -> Decoder a s t Source #

decoderFor :: (s -> Decoder a s t) -> Decoder a s t Source #

split :: (s -> Either String (t, s)) -> Decoder a s t Source #

symbol :: Decoder a [s] s Source #

setInput :: s -> Decoder a s () Source #