Portability | portable (depends on ghc) |
---|---|

Stability | provisional |

Maintainer | bastiaan.heeren@ou.nl |

Safe Haskell | None |

This module defines the concept of an exercise

- data Exercise a
- makeExercise :: (Show a, Eq a, IsTerm a) => Exercise a
- emptyExercise :: Exercise a
- exerciseId :: Exercise a -> Id
- status :: Exercise a -> Status
- parser :: Exercise a -> String -> Either String a
- prettyPrinter :: Exercise a -> a -> String
- equivalence :: Exercise a -> Context a -> Context a -> Bool
- similarity :: Exercise a -> Context a -> Context a -> Bool
- ready :: Exercise a -> Predicate a
- suitable :: Exercise a -> Predicate a
- isReady :: Exercise a -> a -> Bool
- isSuitable :: Exercise a -> a -> Bool
- hasTermView :: Exercise a -> Maybe (View Term a)
- strategy :: Exercise a -> LabeledStrategy (Context a)
- navigation :: Exercise a -> a -> ContextNavigator a
- canBeRestarted :: Exercise a -> Bool
- extraRules :: Exercise a -> [Rule (Context a)]
- ruleOrdering :: Exercise a -> Rule (Context a) -> Rule (Context a) -> Ordering
- difference :: Exercise a -> a -> a -> Maybe (a, a)
- differenceEqual :: Exercise a -> a -> a -> Maybe (a, a)
- testGenerator :: Exercise a -> Maybe (Gen a)
- randomExercise :: Exercise a -> Maybe (StdGen -> Maybe Difficulty -> a)
- examples :: Exercise a -> [(Difficulty, a)]
- getRule :: Monad m => Exercise a -> Id -> m (Rule (Context a))
- simpleGenerator :: Gen a -> Maybe (StdGen -> Maybe Difficulty -> a)
- useGenerator :: (a -> Bool) -> (Maybe Difficulty -> Gen a) -> Maybe (StdGen -> Maybe Difficulty -> a)
- randomTerm :: Exercise a -> Maybe Difficulty -> IO a
- randomTermWith :: StdGen -> Exercise a -> Maybe Difficulty -> Maybe a
- ruleset :: Exercise a -> [Rule (Context a)]
- makeContext :: Exercise a -> Environment -> a -> Context a
- inContext :: Exercise a -> a -> Context a
- recognizeRule :: Exercise a -> Rule (Context a) -> Context a -> Context a -> [(Location, Environment)]
- ruleOrderingWith :: [Rule a] -> Rule a -> Rule a -> Ordering
- ruleOrderingWithId :: HasId b => [b] -> Rule a -> Rule a -> Ordering
- type Examples a = [(Difficulty, a)]
- mapExamples :: (a -> b) -> Examples a -> Examples b
- examplesContext :: Exercise a -> Examples (Context a)
- data Difficulty
- = VeryEasy
- | Easy
- | Medium
- | Difficult
- | VeryDifficult

- readDifficulty :: String -> Maybe Difficulty
- level :: Difficulty -> [a] -> Examples a
- hasTypeable :: Exercise a -> Maybe (IsTypeable a)
- useTypeable :: Typeable a => Maybe (IsTypeable a)
- castFrom :: Typeable b => Exercise a -> a -> Maybe b
- castTo :: Typeable b => Exercise a -> b -> Maybe a
- data Status
- = Stable
- | Provisional
- | Alpha
- | Experimental

- isPublic :: Exercise a -> Bool
- isPrivate :: Exercise a -> Bool
- withoutContext :: (a -> a -> Bool) -> Context a -> Context a -> Bool
- simpleSimilarity :: Exercise a -> a -> a -> Bool
- simpleEquivalence :: Exercise a -> a -> a -> Bool
- prettyPrinterContext :: Exercise a -> Context a -> String
- restrictGenerator :: (a -> Bool) -> Gen a -> Gen a
- showDerivation :: Exercise a -> a -> String
- printDerivation :: Exercise a -> a -> IO ()
- type ExerciseDerivation a = Derivation (Rule (Context a), Environment) (Context a)
- defaultDerivation :: Exercise a -> a -> ExerciseDerivation a
- derivationDiffEnv :: Derivation s (Context a) -> Derivation (s, Environment) (Context a)
- checkExercise :: Exercise a -> IO ()
- checkParserPretty :: (a -> a -> Bool) -> (String -> Either String a) -> (a -> String) -> a -> Bool
- checkExamples :: Exercise a -> TestSuite
- exerciseTestSuite :: Exercise a -> TestSuite

# Exercises

exerciseId :: Exercise a -> IdSource

prettyPrinter :: Exercise a -> a -> StringSource

isSuitable :: Exercise a -> a -> BoolSource

strategy :: Exercise a -> LabeledStrategy (Context a)Source

navigation :: Exercise a -> a -> ContextNavigator aSource

canBeRestarted :: Exercise a -> BoolSource

extraRules :: Exercise a -> [Rule (Context a)]Source

difference :: Exercise a -> a -> a -> Maybe (a, a)Source

differenceEqual :: Exercise a -> a -> a -> Maybe (a, a)Source

testGenerator :: Exercise a -> Maybe (Gen a)Source

randomExercise :: Exercise a -> Maybe (StdGen -> Maybe Difficulty -> a)Source

examples :: Exercise a -> [(Difficulty, a)]Source

simpleGenerator :: Gen a -> Maybe (StdGen -> Maybe Difficulty -> a)Source

useGenerator :: (a -> Bool) -> (Maybe Difficulty -> Gen a) -> Maybe (StdGen -> Maybe Difficulty -> a)Source

randomTerm :: Exercise a -> Maybe Difficulty -> IO aSource

randomTermWith :: StdGen -> Exercise a -> Maybe Difficulty -> Maybe aSource

makeContext :: Exercise a -> Environment -> a -> Context aSource

recognizeRule :: Exercise a -> Rule (Context a) -> Context a -> Context a -> [(Location, Environment)]Source

type Examples a = [(Difficulty, a)]Source

mapExamples :: (a -> b) -> Examples a -> Examples bSource

examplesContext :: Exercise a -> Examples (Context a)Source

data Difficulty Source

level :: Difficulty -> [a] -> Examples aSource

hasTypeable :: Exercise a -> Maybe (IsTypeable a)Source

useTypeable :: Typeable a => Maybe (IsTypeable a)Source

# Exercise status

Stable | A released exercise that has undergone some thorough testing |

Provisional | A released exercise, possibly with some deficiencies |

Alpha | An exercise that is under development |

Experimental | An exercise for experimentation purposes only |

# Miscellaneous

withoutContext :: (a -> a -> Bool) -> Context a -> Context a -> BoolSource

Function for defining equivalence or similarity without taking the context into account.

simpleSimilarity :: Exercise a -> a -> a -> BoolSource

Similarity on terms without a context

simpleEquivalence :: Exercise a -> a -> a -> BoolSource

Equivalence on terms without a context

prettyPrinterContext :: Exercise a -> Context a -> StringSource

restrictGenerator :: (a -> Bool) -> Gen a -> Gen aSource

showDerivation :: Exercise a -> a -> StringSource

Shows a derivation for a given start term. The specified rule ordering is used for selection.

printDerivation :: Exercise a -> a -> IO ()Source

type ExerciseDerivation a = Derivation (Rule (Context a), Environment) (Context a)Source

defaultDerivation :: Exercise a -> a -> ExerciseDerivation aSource

derivationDiffEnv :: Derivation s (Context a) -> Derivation (s, Environment) (Context a)Source

checkExercise :: Exercise a -> IO ()Source

checkParserPretty :: (a -> a -> Bool) -> (String -> Either String a) -> (a -> String) -> a -> BoolSource

checkExamples :: Exercise a -> TestSuiteSource

exerciseTestSuite :: Exercise a -> TestSuiteSource