-
Notifications
You must be signed in to change notification settings - Fork 1
Description
This module is the most straightforward of the set.
You only need to define the description function to produce a task description via OutputCapable.
description has the following type signature:
description :: OutputCapable m => FilePath -> TaskData -> LangM mThis is mostly identical to the feedback functions used in Check.
You'll string together output blocks to build a coherent task description.
Avoid using aborting functions entirely.
As before, the FilePath argument can be used to cache images or files, but can be ignored if unnecessary.
You may add more constraints on m, just as explained in TaskData.
Here's the full list of options:
MonadDiagramsMonadGraphvizMonadCacheMonadLatexSvgMonadPlantUml-
MonadWriteFile(deprecated; try usingMonadCacheinstead) MonadThrow
Here's a simple example of a task description for calculating the GCD of two numbers:
{-# language ApplicativeDo #-}
description :: OutputCapable m => FilePath -> TaskData -> LangM m
description _ (a,b)= do
paragraph $ do
translate $ do
english "Calculate the greatest common denominator of these numbers:"
german "Berechnen Sie den größten gemeinsamen Nenner der Zahlen:"
indent $ code $ show a
indent $ code $ show b
pure ()
paragraph $
translate $ do
english "Use the Euclidean algorithm to do so "
english "and keep track of the number of iterations performed."
german "Verwenden Sie den Euklidischen Algorithmus "
german "und notieren Sie sich die Anzahl der Iterationen."
paragraph $
translate $ do
english "Submit your solution via the left input field. "
english "Enter the amount of iterations into the right field."
german "Geben Sie Ihre Lösung im linken Eingabefeld ab. "
german "Die Anzahl der Iterationen geben Sie im rechten Feld ein."
pure ()💡 A common mistake here is incorrect indentation or forgetting
do/pure. Every encapsulated block needs its own openingdoand closingpure.
Author: patrick.ritzenfeld@uni-due.de