Safe Haskell | None |
---|---|
Language | Haskell2010 |
Control.OutputCapable.Blocks
Description
This module provides common skeletons for printing tasks
Synopsis
- class (forall (g :: Type -> Type). Functor g => Functor (t g)) => FunctorTrans (t :: (Type -> Type) -> Type -> Type) where
- data GenericOut l o
- newtype GenericReportT l o (m :: Type -> Type) r = Report {
- unReport :: MaybeT (WriterT [GenericOut l o] m) r
- data Language
- type Out = GenericOut Language
- type ReportT = GenericReportT Language
- type Report o r = ReportT o Identity r
- getAllOuts :: Monad m => GenericReportT l o m () -> m [GenericOut l o]
- getOutsWithResult :: GenericReportT l o m a -> m (Maybe a, [GenericOut l o])
- toOutput :: GenericOut l o -> l -> o
- newtype GenericLangM l (m :: Type -> Type) a = LangM {
- unLangM :: m a
- type LangM' (m :: Type -> Type) a = GenericLangM Language m a
- type LangM (m :: Type -> Type) = LangM' m ()
- type Rated (m :: Type -> Type) = LangM' m Rational
- class (Applicative m, Ord l) => GenericOutputCapable l (m :: Type -> Type) where
- assertion :: Bool -> GenericLangM l m () -> GenericLangM l m ()
- image :: FilePath -> GenericLangM l m ()
- images :: (k -> String) -> (a -> FilePath) -> Map k a -> GenericLangM l m ()
- paragraph :: GenericLangM l m () -> GenericLangM l m ()
- refuse :: GenericLangM l m () -> GenericLangM l m ()
- text :: String -> GenericLangM l m ()
- enumerateM :: (a -> GenericLangM l m ()) -> [(a, GenericLangM l m ())] -> GenericLangM l m ()
- itemizeM :: [GenericLangM l m ()] -> GenericLangM l m ()
- indent :: GenericLangM l m () -> GenericLangM l m ()
- latex :: String -> GenericLangM l m ()
- folded :: Bool -> (l -> String) -> GenericLangM l m () -> GenericLangM l m ()
- code :: String -> GenericLangM l m ()
- translatedCode :: (l -> String) -> GenericLangM l m ()
- translated :: (l -> String) -> GenericLangM l m ()
- type OutputCapable (m :: Type -> Type) = GenericOutputCapable Language m
- enumerate :: forall l (m :: Type -> Type) k a. GenericOutputCapable l m => (k -> String) -> (a -> String) -> Map k a -> GenericLangM l m ()
- abortWith :: forall (m :: Type -> Type) o l. Monad m => o -> GenericLangM l (GenericReportT l o m) ()
- alignOutput :: forall (m :: Type -> Type) o l. Monad m => ([o] -> o) -> GenericLangM l (GenericReportT l o m) () -> GenericLangM l (GenericReportT l o m) ()
- combineReports :: forall (m :: Type -> Type) o l. Monad m => ([[o]] -> o) -> [GenericLangM l (GenericReportT l o m) ()] -> GenericLangM l (GenericReportT l o m) ()
- combineTwoReports :: forall (m :: Type -> Type) o l. Monad m => ([o] -> [o] -> o) -> GenericLangM l (GenericReportT l o m) () -> GenericLangM l (GenericReportT l o m) () -> GenericLangM l (GenericReportT l o m) ()
- format :: forall (m :: Type -> Type) o l. Monad m => o -> GenericLangM l (GenericReportT l o m) ()
- recoverFrom :: forall (m :: Type -> Type) l. Alternative m => GenericLangM l m () -> GenericLangM l m ()
- recoverWith :: forall (m :: Type -> Type) a l b. Alternative m => a -> GenericLangM l m b -> GenericLangM l m (Either a b)
- toAbort :: forall (m :: Type -> Type) l o. Monad m => GenericLangM l (GenericReportT l o m) () -> GenericLangM l (GenericReportT l o m) ()
- data ArticleToUse
- collapsed :: forall l (m :: Type -> Type). GenericOutputCapable l m => Bool -> State (Map l String) () -> GenericLangM l m () -> GenericLangM l m ()
- english :: String -> State (Map Language String) ()
- german :: String -> State (Map Language String) ()
- localise :: Language -> Map Language String -> String
- mapLangM :: (m a -> m b) -> GenericLangM l m a -> GenericLangM l m b
- multiLang :: forall (m :: Type -> Type). OutputCapable m => [(Language, String)] -> LangM m
- translate :: forall l (m :: Type -> Type). GenericOutputCapable l m => State (Map l String) () -> GenericLangM l m ()
- translateCode :: forall l (m :: Type -> Type). GenericOutputCapable l m => State (Map l String) () -> GenericLangM l m ()
- translations :: State (Map l a) () -> Map l a
- newtype MinimumThreshold = MinimumThreshold {}
- newtype Punishment = Punishment {}
- newtype TargetedCorrect = TargetedCorrect {}
- ($=<<) :: Monad m => (a -> GenericLangM l m b) -> m a -> GenericLangM l m b
- extendedMultipleChoice :: forall (m :: Type -> Type) a. (OutputCapable m, Ord a) => MinimumThreshold -> Punishment -> TargetedCorrect -> ArticleToUse -> Map Language String -> Maybe String -> Map a Bool -> Map a Bool -> Rated m
- multipleChoice :: forall (m :: Type -> Type) a. (OutputCapable m, Ord a) => ArticleToUse -> Map Language String -> Maybe String -> Map a Bool -> [a] -> Rated m
- multipleChoiceSyntax :: forall (m :: Type -> Type) a. (OutputCapable m, Ord a, Show a) => Bool -> [a] -> [a] -> LangM m
- printSolutionAndAssert :: forall (m :: Type -> Type). OutputCapable m => ArticleToUse -> Maybe String -> Rational -> Rated m
- printSolutionAndAssertMinimum :: forall (m :: Type -> Type). OutputCapable m => MinimumThreshold -> ArticleToUse -> Maybe String -> Rational -> Rated m
- reRefuse :: forall (m :: Type -> Type). (Alternative m, Monad m, OutputCapable m) => Rated m -> LangM m -> Rated m
- reRefuseLangM :: forall (m :: Type -> Type). (Alternative m, Monad m, OutputCapable m) => LangM m -> LangM m -> LangM m
- singleChoice :: forall (m :: Type -> Type) a. (OutputCapable m, Eq a) => ArticleToUse -> Map Language String -> Maybe String -> a -> a -> LangM m
- singleChoiceSyntax :: forall (m :: Type -> Type) a. (OutputCapable m, Eq a, Show a) => Bool -> [a] -> a -> LangM m
- continueOrAbort :: forall (m :: Type -> Type). OutputCapable m => Bool -> Bool -> LangM m -> LangM m
- yesNo :: forall (m :: Type -> Type). OutputCapable m => Bool -> LangM m -> LangM m
Documentation
class (forall (g :: Type -> Type). Functor g => Functor (t g)) => FunctorTrans (t :: (Type -> Type) -> Type -> Type) where Source #
The class of functor transformers.
Lifting a functor to the stacked functor.
Methods
lift :: Functor f => f a -> t f a Source #
Lift a computation from the argument functor to the constructed functor.
Instances
FunctorTrans (GenericLangM l) Source # | |
Defined in Control.OutputCapable.Blocks.Generic Methods lift :: Functor f => f a -> GenericLangM l f a Source # |
Report monad
data GenericOut l o Source #
Instances
Functor (GenericOut l) Source # | |
Defined in Control.OutputCapable.Blocks.Report.Generic Methods fmap :: (a -> b) -> GenericOut l a -> GenericOut l b # (<$) :: a -> GenericOut l b -> GenericOut l a # |
newtype GenericReportT l o (m :: Type -> Type) r Source #
Constructors
Report | |
Fields
|
Instances
Instances
Data Language Source # | |||||
Defined in Control.OutputCapable.Blocks.Report Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Language -> c Language # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Language # toConstr :: Language -> Constr # dataTypeOf :: Language -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Language) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Language) # gmapT :: (forall b. Data b => b -> b) -> Language -> Language # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Language -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Language -> r # gmapQ :: (forall d. Data d => d -> u) -> Language -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Language -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Language -> m Language # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Language -> m Language # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Language -> m Language # | |||||
Bounded Language Source # | |||||
Enum Language Source # | |||||
Defined in Control.OutputCapable.Blocks.Report | |||||
Generic Language Source # | |||||
Defined in Control.OutputCapable.Blocks.Report Associated Types
| |||||
Read Language Source # | |||||
Show Language Source # | |||||
Eq Language Source # | |||||
Ord Language Source # | |||||
Defined in Control.OutputCapable.Blocks.Report | |||||
type Rep Language Source # | |||||
Defined in Control.OutputCapable.Blocks.Report |
type Out = GenericOut Language Source #
type ReportT = GenericReportT Language Source #
getAllOuts :: Monad m => GenericReportT l o m () -> m [GenericOut l o] Source #
This is a more specific version of getAllOuts
which enforces the usage pattern.
You should always prefer this version over the generic.
getOutsWithResult :: GenericReportT l o m a -> m (Maybe a, [GenericOut l o]) Source #
toOutput :: GenericOut l o -> l -> o Source #
Monad for translations
newtype GenericLangM l (m :: Type -> Type) a Source #
Instances
FunctorTrans (GenericLangM l) Source # | |
Defined in Control.OutputCapable.Blocks.Generic Methods lift :: Functor f => f a -> GenericLangM l f a Source # | |
Applicative m => Applicative (GenericLangM l m) Source # | |
Defined in Control.OutputCapable.Blocks.Generic Methods pure :: a -> GenericLangM l m a # (<*>) :: GenericLangM l m (a -> b) -> GenericLangM l m a -> GenericLangM l m b # liftA2 :: (a -> b -> c) -> GenericLangM l m a -> GenericLangM l m b -> GenericLangM l m c # (*>) :: GenericLangM l m a -> GenericLangM l m b -> GenericLangM l m b # (<*) :: GenericLangM l m a -> GenericLangM l m b -> GenericLangM l m a # | |
Functor m => Functor (GenericLangM l m) Source # | |
Defined in Control.OutputCapable.Blocks.Generic Methods fmap :: (a -> b) -> GenericLangM l m a -> GenericLangM l m b # (<$) :: a -> GenericLangM l m b -> GenericLangM l m a # |
Output monad
class (Applicative m, Ord l) => GenericOutputCapable l (m :: Type -> Type) where Source #
Minimal complete definition
assertion, image, images, paragraph, refuse, enumerateM, itemizeM, indent, latex, folded, translatedCode, translated
Methods
assertion :: Bool -> GenericLangM l m () -> GenericLangM l m () Source #
for assertions, i.e. expected behaviour is explanation
(and abortion on False
)
image :: FilePath -> GenericLangM l m () Source #
for printing a single image from file
images :: (k -> String) -> (a -> FilePath) -> Map k a -> GenericLangM l m () Source #
for printing multiple images using the given map
paragraph :: GenericLangM l m () -> GenericLangM l m () Source #
for a complete paragraph
refuse :: GenericLangM l m () -> GenericLangM l m () Source #
should abort at once
text :: String -> GenericLangM l m () Source #
for displaying text
enumerateM :: (a -> GenericLangM l m ()) -> [(a, GenericLangM l m ())] -> GenericLangM l m () Source #
for an enumerated sequence of elements
itemizeM :: [GenericLangM l m ()] -> GenericLangM l m () Source #
for an unenumerated sequence of elements
indent :: GenericLangM l m () -> GenericLangM l m () Source #
for indentation
latex :: String -> GenericLangM l m () Source #
for LaTeX-Math code (i.e. without surrounding $
)
folded :: Bool -> (l -> String) -> GenericLangM l m () -> GenericLangM l m () Source #
for minimisable output with a default state (open/closed) and title
code :: String -> GenericLangM l m () Source #
for fixed width fonts (i.e. typewriter style)
translatedCode :: (l -> String) -> GenericLangM l m () Source #
same as code
, but with different translations
translated :: (l -> String) -> GenericLangM l m () Source #
for displaying text with translations
Instances
Ord l => GenericOutputCapable l Maybe Source # | |
Defined in Control.OutputCapable.Blocks.Generic Methods assertion :: Bool -> GenericLangM l Maybe () -> GenericLangM l Maybe () Source # image :: FilePath -> GenericLangM l Maybe () Source # images :: (k -> String) -> (a -> FilePath) -> Map k a -> GenericLangM l Maybe () Source # paragraph :: GenericLangM l Maybe () -> GenericLangM l Maybe () Source # refuse :: GenericLangM l Maybe () -> GenericLangM l Maybe () Source # text :: String -> GenericLangM l Maybe () Source # enumerateM :: (a -> GenericLangM l Maybe ()) -> [(a, GenericLangM l Maybe ())] -> GenericLangM l Maybe () Source # itemizeM :: [GenericLangM l Maybe ()] -> GenericLangM l Maybe () Source # indent :: GenericLangM l Maybe () -> GenericLangM l Maybe () Source # latex :: String -> GenericLangM l Maybe () Source # folded :: Bool -> (l -> String) -> GenericLangM l Maybe () -> GenericLangM l Maybe () Source # code :: String -> GenericLangM l Maybe () Source # translatedCode :: (l -> String) -> GenericLangM l Maybe () Source # translated :: (l -> String) -> GenericLangM l Maybe () Source # | |
l ~ Language => GenericOutputCapable l (GenericReportT l (IO ()) IO) Source # | |
Defined in Control.OutputCapable.Blocks Methods assertion :: Bool -> GenericLangM l (GenericReportT l (IO ()) IO) () -> GenericLangM l (GenericReportT l (IO ()) IO) () Source # image :: FilePath -> GenericLangM l (GenericReportT l (IO ()) IO) () Source # images :: (k -> String) -> (a -> FilePath) -> Map k a -> GenericLangM l (GenericReportT l (IO ()) IO) () Source # paragraph :: GenericLangM l (GenericReportT l (IO ()) IO) () -> GenericLangM l (GenericReportT l (IO ()) IO) () Source # refuse :: GenericLangM l (GenericReportT l (IO ()) IO) () -> GenericLangM l (GenericReportT l (IO ()) IO) () Source # text :: String -> GenericLangM l (GenericReportT l (IO ()) IO) () Source # enumerateM :: (a -> GenericLangM l (GenericReportT l (IO ()) IO) ()) -> [(a, GenericLangM l (GenericReportT l (IO ()) IO) ())] -> GenericLangM l (GenericReportT l (IO ()) IO) () Source # itemizeM :: [GenericLangM l (GenericReportT l (IO ()) IO) ()] -> GenericLangM l (GenericReportT l (IO ()) IO) () Source # indent :: GenericLangM l (GenericReportT l (IO ()) IO) () -> GenericLangM l (GenericReportT l (IO ()) IO) () Source # latex :: String -> GenericLangM l (GenericReportT l (IO ()) IO) () Source # folded :: Bool -> (l -> String) -> GenericLangM l (GenericReportT l (IO ()) IO) () -> GenericLangM l (GenericReportT l (IO ()) IO) () Source # code :: String -> GenericLangM l (GenericReportT l (IO ()) IO) () Source # translatedCode :: (l -> String) -> GenericLangM l (GenericReportT l (IO ()) IO) () Source # translated :: (l -> String) -> GenericLangM l (GenericReportT l (IO ()) IO) () Source # | |
(Bounded language, Enum language, Monad m, Ord language) => GenericOutputCapable language (GenericReportT language (GenericOutput language element) m) Source # | OutputCapable instances for |
Defined in Control.OutputCapable.Blocks.Generic.Type Methods assertion :: Bool -> GenericLangM language (GenericReportT language (GenericOutput language element) m) () -> GenericLangM language (GenericReportT language (GenericOutput language element) m) () Source # image :: FilePath -> GenericLangM language (GenericReportT language (GenericOutput language element) m) () Source # images :: (k -> String) -> (a -> FilePath) -> Map k a -> GenericLangM language (GenericReportT language (GenericOutput language element) m) () Source # paragraph :: GenericLangM language (GenericReportT language (GenericOutput language element) m) () -> GenericLangM language (GenericReportT language (GenericOutput language element) m) () Source # refuse :: GenericLangM language (GenericReportT language (GenericOutput language element) m) () -> GenericLangM language (GenericReportT language (GenericOutput language element) m) () Source # text :: String -> GenericLangM language (GenericReportT language (GenericOutput language element) m) () Source # enumerateM :: (a -> GenericLangM language (GenericReportT language (GenericOutput language element) m) ()) -> [(a, GenericLangM language (GenericReportT language (GenericOutput language element) m) ())] -> GenericLangM language (GenericReportT language (GenericOutput language element) m) () Source # itemizeM :: [GenericLangM language (GenericReportT language (GenericOutput language element) m) ()] -> GenericLangM language (GenericReportT language (GenericOutput language element) m) () Source # indent :: GenericLangM language (GenericReportT language (GenericOutput language element) m) () -> GenericLangM language (GenericReportT language (GenericOutput language element) m) () Source # latex :: String -> GenericLangM language (GenericReportT language (GenericOutput language element) m) () Source # folded :: Bool -> (language -> String) -> GenericLangM language (GenericReportT language (GenericOutput language element) m) () -> GenericLangM language (GenericReportT language (GenericOutput language element) m) () Source # code :: String -> GenericLangM language (GenericReportT language (GenericOutput language element) m) () Source # translatedCode :: (language -> String) -> GenericLangM language (GenericReportT language (GenericOutput language element) m) () Source # translated :: (language -> String) -> GenericLangM language (GenericReportT language (GenericOutput language element) m) () Source # |
type OutputCapable (m :: Type -> Type) = GenericOutputCapable Language m Source #
enumerate :: forall l (m :: Type -> Type) k a. GenericOutputCapable l m => (k -> String) -> (a -> String) -> Map k a -> GenericLangM l m () Source #
abortWith :: forall (m :: Type -> Type) o l. Monad m => o -> GenericLangM l (GenericReportT l o m) () Source #
alignOutput :: forall (m :: Type -> Type) o l. Monad m => ([o] -> o) -> GenericLangM l (GenericReportT l o m) () -> GenericLangM l (GenericReportT l o m) () Source #
This is a more specific version of alignOutput
which enforces the usage pattern.
You should always prefer this version over the generic.
combineReports :: forall (m :: Type -> Type) o l. Monad m => ([[o]] -> o) -> [GenericLangM l (GenericReportT l o m) ()] -> GenericLangM l (GenericReportT l o m) () Source #
This is a more specific version of combineReports
which enforces the usage pattern.
You should always prefer this version over the generic.
combineTwoReports :: forall (m :: Type -> Type) o l. Monad m => ([o] -> [o] -> o) -> GenericLangM l (GenericReportT l o m) () -> GenericLangM l (GenericReportT l o m) () -> GenericLangM l (GenericReportT l o m) () Source #
This is a more specific version of combineTwoReports
which enforces the usage pattern.
You should always prefer this version over the generic.
format :: forall (m :: Type -> Type) o l. Monad m => o -> GenericLangM l (GenericReportT l o m) () Source #
recoverFrom :: forall (m :: Type -> Type) l. Alternative m => GenericLangM l m () -> GenericLangM l m () Source #
recoverWith :: forall (m :: Type -> Type) a l b. Alternative m => a -> GenericLangM l m b -> GenericLangM l m (Either a b) Source #
toAbort :: forall (m :: Type -> Type) l o. Monad m => GenericLangM l (GenericReportT l o m) () -> GenericLangM l (GenericReportT l o m) () Source #
This is a more specific version of toAbort
which enforces the usage pattern.
You should always prefer this version over the generic.
Translation
data ArticleToUse Source #
Use the specified article.
Constructors
DefiniteArticle | use definite article(s) |
IndefiniteArticle | use indefinite article(s) |
Instances
Data ArticleToUse Source # | |||||
Defined in Control.OutputCapable.Blocks Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ArticleToUse -> c ArticleToUse # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ArticleToUse # toConstr :: ArticleToUse -> Constr # dataTypeOf :: ArticleToUse -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ArticleToUse) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ArticleToUse) # gmapT :: (forall b. Data b => b -> b) -> ArticleToUse -> ArticleToUse # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ArticleToUse -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ArticleToUse -> r # gmapQ :: (forall d. Data d => d -> u) -> ArticleToUse -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> ArticleToUse -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> ArticleToUse -> m ArticleToUse # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ArticleToUse -> m ArticleToUse # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ArticleToUse -> m ArticleToUse # | |||||
Generic ArticleToUse Source # | |||||
Defined in Control.OutputCapable.Blocks Associated Types
| |||||
Read ArticleToUse Source # | |||||
Defined in Control.OutputCapable.Blocks Methods readsPrec :: Int -> ReadS ArticleToUse # readList :: ReadS [ArticleToUse] # | |||||
Show ArticleToUse Source # | |||||
Defined in Control.OutputCapable.Blocks Methods showsPrec :: Int -> ArticleToUse -> ShowS # show :: ArticleToUse -> String # showList :: [ArticleToUse] -> ShowS # | |||||
Eq ArticleToUse Source # | |||||
Defined in Control.OutputCapable.Blocks | |||||
type Rep ArticleToUse Source # | |||||
Defined in Control.OutputCapable.Blocks |
collapsed :: forall l (m :: Type -> Type). GenericOutputCapable l m => Bool -> State (Map l String) () -> GenericLangM l m () -> GenericLangM l m () Source #
This is a more specific version of collapsed
which enforces the usage pattern.
You should always prefer this version over the generic.
english :: String -> State (Map Language String) () Source #
Provide an English translation to be appended after previous English translations.
german :: String -> State (Map Language String) () Source #
Provide an German translation to be appended after previous German translations.
mapLangM :: (m a -> m b) -> GenericLangM l m a -> GenericLangM l m b Source #
multiLang :: forall (m :: Type -> Type). OutputCapable m => [(Language, String)] -> LangM m Source #
translate :: forall l (m :: Type -> Type). GenericOutputCapable l m => State (Map l String) () -> GenericLangM l m () Source #
This is a more specific version of translate
which enforces the usage pattern.
You should always prefer this version over the generic.
translateCode :: forall l (m :: Type -> Type). GenericOutputCapable l m => State (Map l String) () -> GenericLangM l m () Source #
This is a more specific version of translateCode
which enforces the usage pattern.
You should always prefer this version over the generic.
translations :: State (Map l a) () -> Map l a Source #
This is a more specific version of translations
which enforces the usage pattern.
You should always prefer this version over the generic.
Helper functions
newtype MinimumThreshold Source #
A Rational
number indicating the minimal threshold.
Constructors
MinimumThreshold | |
Fields |
newtype Punishment Source #
A Rational
number indicating the punishment.
Constructors
Punishment | |
Fields |
newtype TargetedCorrect Source #
A Int
number indicating expected correct answers.
Constructors
TargetedCorrect | |
Fields |
($=<<) :: Monad m => (a -> GenericLangM l m b) -> m a -> GenericLangM l m b infixr 0 Source #
extendedMultipleChoice Source #
Arguments
:: forall (m :: Type -> Type) a. (OutputCapable m, Ord a) | |
=> MinimumThreshold | the minimum threshold of achieved points |
-> Punishment | points to subtract per wrong answer |
-> TargetedCorrect | how many correct answers have to be given within the submission in order to achieve full points |
-> ArticleToUse | indicating if multiple different solutions could be possible |
-> Map Language String | what is asked for |
-> Maybe String | the correct solution to show |
-> Map a Bool | possible answers and if they are correct |
-> Map a Bool | the submission to evaluate |
-> Rated m |
Evaluates multiple choice submissions by rejecting correctness below a minimum threshold.
The following preconditions need to hold before calling this function but are not checked:
- targeted correct is at least one and not larger than the amount of possible answers
Arguments
:: forall (m :: Type -> Type) a. (OutputCapable m, Ord a) | |
=> ArticleToUse | indicating if multiple different solutions could be possible |
-> Map Language String | what is asked for |
-> Maybe String | the correct solution to show |
-> Map a Bool | possible answers and if they are correct |
-> [a] | the submission to evaluate |
-> Rated m |
Evaluates multiple choice submissions
by rejecting correctness below 50 percent.
(see extendedMultipleChoice
)
Arguments
:: forall (m :: Type -> Type) a. (OutputCapable m, Ord a, Show a) | |
=> Bool | whether to continue after check (i.e. do not reject wrong answers) |
-> [a] | possible answers |
-> [a] | the submission to evaluate |
-> LangM m |
Outputs feedback on syntax of a multiple choice submission. Depending on chosen parameters it might reject the submission.
printSolutionAndAssert Source #
Arguments
:: forall (m :: Type -> Type). OutputCapable m | |
=> ArticleToUse | indicating if multiple different solutions could be possible |
-> Maybe String | the correct solution to show |
-> Rational | points achieved |
-> Rated m |
Outputs the correct solution (if given)
when achieved points are less than 100 percent.
No points are distributed if not at least 50 percent are achieved.
(see printSolutionAndAssertMinimum
)
printSolutionAndAssertMinimum Source #
Arguments
:: forall (m :: Type -> Type). OutputCapable m | |
=> MinimumThreshold | the minimum threshold of achieved points |
-> ArticleToUse | indicating if multiple different solutions could be possible |
-> Maybe String | the correct solution to show |
-> Rational | points achieved |
-> Rated m |
Outputs the correct solution (if given) when achieved points are less than 100 percent. No points are distributed if they do not reach the minimum threshold.
reRefuse :: forall (m :: Type -> Type). (Alternative m, Monad m, OutputCapable m) => Rated m -> LangM m -> Rated m Source #
Append some remarks after some rating function. But re-reject afterwards (if it was rejected by the rating function).
reRefuseLangM :: forall (m :: Type -> Type). (Alternative m, Monad m, OutputCapable m) => LangM m -> LangM m -> LangM m Source #
Append some remarks after a potential rejection. But re-reject afterwards (if it was rejected before).
Since: 0.4.0.3
Arguments
:: forall (m :: Type -> Type) a. (OutputCapable m, Eq a) | |
=> ArticleToUse | indicating if multiple different solutions could be possible |
-> Map Language String | what is asked for |
-> Maybe String | the correct solution to show |
-> a | the correct answer |
-> a | the submission to evaluate |
-> LangM m |
Outputs feedback and rates a single choice submission.
Arguments
:: forall (m :: Type -> Type) a. (OutputCapable m, Eq a, Show a) | |
=> Bool | whether to continue after check (i.e. do not reject wrong answers) |
-> [a] | possible answers |
-> a | the submission to evaluate |
-> LangM m |
Outputs feedback on syntax of a single choice submission. Depending on chosen parameters it might reject the submission.
continueOrAbort :: forall (m :: Type -> Type). OutputCapable m => Bool -> Bool -> LangM m -> LangM m Source #
If argument is True
,
it will continue after assertion,
otherwise it will stop if assertion fails.
yesNo :: forall (m :: Type -> Type). OutputCapable m => Bool -> LangM m -> LangM m Source #
In contrast to assertion
it will only indicate that a check was performed
and its result.
However, it will not abort.
Orphan instances
l ~ Language => GenericOutputCapable l (GenericReportT l (IO ()) IO) Source # | |||||||||
Methods assertion :: Bool -> GenericLangM l (GenericReportT l (IO ()) IO) () -> GenericLangM l (GenericReportT l (IO ()) IO) () Source # image :: FilePath -> GenericLangM l (GenericReportT l (IO ()) IO) () Source # images :: (k -> String) -> (a -> FilePath) -> Map k a -> GenericLangM l (GenericReportT l (IO ()) IO) () Source # paragraph :: GenericLangM l (GenericReportT l (IO ()) IO) () -> GenericLangM l (GenericReportT l (IO ()) IO) () Source # refuse :: GenericLangM l (GenericReportT l (IO ()) IO) () -> GenericLangM l (GenericReportT l (IO ()) IO) () Source # text :: String -> GenericLangM l (GenericReportT l (IO ()) IO) () Source # enumerateM :: (a -> GenericLangM l (GenericReportT l (IO ()) IO) ()) -> [(a, GenericLangM l (GenericReportT l (IO ()) IO) ())] -> GenericLangM l (GenericReportT l (IO ()) IO) () Source # itemizeM :: [GenericLangM l (GenericReportT l (IO ()) IO) ()] -> GenericLangM l (GenericReportT l (IO ()) IO) () Source # indent :: GenericLangM l (GenericReportT l (IO ()) IO) () -> GenericLangM l (GenericReportT l (IO ()) IO) () Source # latex :: String -> GenericLangM l (GenericReportT l (IO ()) IO) () Source # folded :: Bool -> (l -> String) -> GenericLangM l (GenericReportT l (IO ()) IO) () -> GenericLangM l (GenericReportT l (IO ()) IO) () Source # code :: String -> GenericLangM l (GenericReportT l (IO ()) IO) () Source # translatedCode :: (l -> String) -> GenericLangM l (GenericReportT l (IO ()) IO) () Source # translated :: (l -> String) -> GenericLangM l (GenericReportT l (IO ()) IO) () Source # | |||||||||
l ~ Language => RunnableOutputCapable l (GenericReportT l (IO ()) IO) Source # | |||||||||
Associated Types
Methods runLangM :: GenericLangM l (GenericReportT l (IO ()) IO) a -> RunMonad l (GenericReportT l (IO ()) IO) (Maybe a, l -> Output l (GenericReportT l (IO ()) IO)) Source # |