Maintainer | bastiaan.heeren@ou.nl |
---|---|
Stability | provisional |
Portability | portable (depends on ghc) |
Safe Haskell | None |
Language | Haskell98 |
Exports most from package Common
Synopsis
- class Category a => Arrow (a :: * -> * -> *) where
- class Arrow a => ArrowZero (a :: * -> * -> *) where
- class ArrowZero a => ArrowPlus (a :: * -> * -> *) where
- class Arrow a => ArrowChoice (a :: * -> * -> *) where
- (>>>) :: Category cat => cat a b -> cat b c -> cat a c
- (<<<) :: Category cat => cat b c -> cat a b -> cat a c
- class Minor a where
- class Buggy a where
- class BoolValue a => Boolean a where
- class BoolValue a where
- class Fix a where
- class BiFunctor f where
- class Arrow arr => BiArrow arr where
- class Container f where
- class Apply t where
- apply :: Apply t => t a -> a -> Maybe a
- applicable :: Apply t => t a -> a -> Bool
- applyD :: Apply t => t a -> a -> a
- applyM :: (Apply t, Monad m) => t a -> a -> m a
- applyList :: Apply t => [t a] -> a -> Maybe a
- mapBoth :: BiFunctor f => (a -> b) -> f a a -> f b b
- ands :: Boolean a => [a] -> a
- ors :: Boolean a => [a] -> a
- implies :: Boolean a => a -> a -> a
- equivalent :: Boolean a => a -> a -> a
- data Some f = Some (f a)
- readM :: (Monad m, Read a) => String -> m a
- class HasId a where
- class HasId a => Identify a where
- class IsId a where
- data Id
- (#) :: (IsId a, IsId b) => a -> b -> Id
- unqualified :: HasId a => a -> String
- qualifiers :: HasId a => a -> [String]
- qualification :: HasId a => a -> String
- description :: HasId a => a -> String
- describe :: HasId a => String -> a -> a
- showId :: HasId a => a -> String
- compareId :: HasId a => a -> a -> Ordering
- data ViewPackage where
- ViewPackage :: (Show a, Show b, Eq a) => (String -> Maybe a) -> View a b -> ViewPackage
- class LiftView f where
- data Isomorphism a b
- data View a b
- class IsMatcher f => IsView f where
- data Matcher a b
- class IsMatcher f where
- matchM :: (Monad m, IsMatcher f) => f a b -> a -> m b
- belongsTo :: IsMatcher f => a -> f a b -> Bool
- viewEquivalent :: (IsMatcher f, Eq b) => f a b -> a -> a -> Bool
- viewEquivalentWith :: IsMatcher f => (b -> b -> Bool) -> f a b -> a -> a -> Bool
- makeMatcher :: (a -> Maybe b) -> Matcher a b
- canonical :: IsView f => f a b -> a -> Maybe a
- canonicalWith :: IsView f => (b -> b) -> f a b -> a -> Maybe a
- canonicalWithM :: IsView f => (b -> Maybe b) -> f a b -> a -> Maybe a
- isCanonical :: (IsView f, Eq a) => f a b -> a -> Bool
- isCanonicalWith :: IsView f => (a -> a -> Bool) -> f a b -> a -> Bool
- simplify :: IsView f => f a b -> a -> a
- simplifyWith :: IsView f => (b -> b) -> f a b -> a -> a
- simplifyWithM :: IsView f => (b -> Maybe b) -> f a b -> a -> a
- makeView :: (a -> Maybe b) -> (b -> a) -> View a b
- matcherView :: Matcher a b -> (b -> a) -> View a b
- identity :: Category f => f a a
- inverse :: Isomorphism a b -> Isomorphism b a
- swapView :: Isomorphism (a, b) (b, a)
- listView :: View a b -> View [a] [b]
- traverseView :: Traversable f => View a b -> View (f a) (f b)
- ($<) :: Traversable f => View a (f b) -> View b c -> View a (f c)
- propIdempotence :: (Show a, Eq a) => Gen a -> View a b -> Property
- propSoundness :: Show a => (a -> a -> Bool) -> Gen a -> View a c -> Property
- propNormalForm :: (Show a, Eq a) => Gen a -> View a b -> Property
- data Predicate a
- predicate :: (a -> Bool) -> Predicate a
- predicateView :: View a b -> Predicate a
- evalPredicate :: Predicate a -> a -> Bool
- data Difficulty
- = VeryEasy
- | Easy
- | Medium
- | Difficult
- | VeryDifficult
- data Examples a
- examplesFor :: Difficulty -> [a] -> Examples a
- examplesWithDifficulty :: [(Difficulty, a)] -> Examples a
- readDifficulty :: String -> Maybe Difficulty
- data Constraint a
- makeConstraint :: IsId n => n -> (a -> Result ()) -> Constraint a
- isRelevant :: Constraint a -> a -> Bool
- isSatisfied :: Constraint a -> a -> Bool
- isViolated :: Constraint a -> a -> Maybe String
- relevance :: Result a -> Result a
- castFrom :: (HasTypeable f, Typeable b) => f a -> a -> Maybe b
- castTo :: (HasTypeable f, Typeable a) => f b -> a -> Maybe b
- location :: Navigator a => a -> Location
- data Location
- toLocation :: [Int] -> Location
- top :: Navigator a => a -> a
- arity :: Navigator a => a -> Int
- class WithMetaVars a where
- class WithVars a where
- class WithFunctions a where
- class IsTerm a where
- data Term
- data Symbol
- newSymbol :: IsId a => a -> Symbol
- makeAssociative :: Symbol -> Symbol
- termView :: IsTerm a => View Term a
- trueSymbol :: Symbol
- falseSymbol :: Symbol
- nothingSymbol :: Symbol
- fromTermM :: (Monad m, IsTerm a) => Term -> m a
- fromTermWith :: (Monad m, IsTerm a) => (Symbol -> [a] -> m a) -> Term -> m a
- isSymbol :: WithFunctions a => Symbol -> a -> Bool
- isFunction :: (WithFunctions a, Monad m) => Symbol -> a -> m [a]
- unary :: WithFunctions a => Symbol -> a -> a
- binary :: WithFunctions a => Symbol -> a -> a -> a
- ternary :: WithFunctions a => Symbol -> a -> a -> a -> a
- isUnary :: (WithFunctions a, Monad m) => Symbol -> a -> m a
- isBinary :: (WithFunctions a, Monad m) => Symbol -> a -> m (a, a)
- isVariable :: WithVars a => a -> Bool
- vars :: (Uniplate a, WithVars a) => a -> [String]
- varSet :: (Uniplate a, WithVars a) => a -> Set String
- hasVar :: (Uniplate a, WithVars a) => String -> a -> Bool
- withoutVar :: (Uniplate a, WithVars a) => String -> a -> Bool
- hasSomeVar :: (Uniplate a, WithVars a) => a -> Bool
- hasNoVar :: (Uniplate a, WithVars a) => a -> Bool
- variableView :: WithVars a => View a String
- isMetaVar :: WithMetaVars a => a -> Bool
- metaVars :: (Uniplate a, WithMetaVars a) => a -> [Int]
- metaVarSet :: (Uniplate a, WithMetaVars a) => a -> IntSet
- hasMetaVar :: (Uniplate a, WithMetaVars a) => Int -> a -> Bool
- nextMetaVar :: (Uniplate a, WithMetaVars a) => a -> Int
- toTermG :: Data a => a -> Term
- fromTermG :: (MonadPlus m, Data a) => Term -> m a
- class HasRefs a where
- class HasEnvironment env where
- data Environment
- data Binding
- class (IsTerm a, Typeable a, Show a, Read a) => Reference a where
- data Ref a
- mapRef :: Typeable b => Isomorphism a b -> Ref a -> Ref b
- makeBinding :: Ref a -> a -> Binding
- fromBinding :: Typeable a => Binding -> Maybe (Ref a, a)
- showValue :: Binding -> String
- getTermValue :: Binding -> Term
- makeEnvironment :: [Binding] -> Environment
- singleBinding :: Ref a -> a -> Environment
- bindings :: HasEnvironment env => env -> [Binding]
- noBindings :: HasEnvironment env => env -> Bool
- (?) :: HasEnvironment env => Ref a -> env -> Maybe a
- class (IsTerm a, Show a) => RuleBuilder t a | t -> a where
- class Different a where
- data RewriteRule a
- data RuleSpec a = a :~> a
- makeRewriteRule :: (IsId n, RuleBuilder f a) => n -> f -> RewriteRule a
- termRewriteRule :: (IsId n, IsTerm a, Show a) => n -> RuleSpec Term -> RewriteRule a
- symbolMatcher :: Symbol -> SymbolMatch -> RewriteRule a -> RewriteRule a
- symbolBuilder :: Symbol -> ([Term] -> Term) -> RewriteRule a -> RewriteRule a
- showRewriteRule :: Bool -> RewriteRule a -> Maybe String
- metaInRewriteRule :: RewriteRule a -> [Int]
- renumberRewriteRule :: Int -> RewriteRule a -> RewriteRule a
- data Derivation s a
- emptyDerivation :: a -> Derivation s a
- prepend :: (a, s) -> Derivation s a -> Derivation s a
- extend :: Derivation s a -> (s, a) -> Derivation s a
- merge :: Eq a => Derivation s a -> Derivation s a -> Maybe (Derivation s a)
- mergeBy :: (a -> a -> Bool) -> Derivation s a -> Derivation s a -> Maybe (Derivation s a)
- mergeStep :: Derivation s a -> s -> Derivation s a -> Derivation s a
- derivationToList :: (s -> b) -> (a -> b) -> Derivation s a -> [b]
- derivationFromList :: Monad m => (b -> m s) -> (b -> m a) -> [b] -> m (Derivation s a)
- isEmpty :: Derivation s a -> Bool
- derivationLength :: Derivation s a -> Int
- terms :: Derivation s a -> [a]
- steps :: Derivation s a -> [s]
- triples :: Derivation s a -> [(a, s, a)]
- firstTerm :: Derivation s a -> a
- lastTerm :: Derivation s a -> a
- lastStep :: Derivation s a -> Maybe s
- withoutLast :: Derivation s a -> Derivation s a
- updateSteps :: (a -> s -> a -> t) -> Derivation s a -> Derivation t a
- derivationM :: Monad m => (s -> m ()) -> (a -> m ()) -> Derivation s a -> m ()
- splitStep :: (s -> Bool) -> Derivation s a -> Maybe (Derivation s a, s, Derivation s a)
- data ContextNavigator a
- data Context a
- fromContext :: Monad m => Context a -> m a
- fromContextWith :: Monad m => (a -> b) -> Context a -> m b
- fromContextWith2 :: Monad m => (a -> b -> c) -> Context a -> Context b -> m c
- newContext :: ContextNavigator a -> Context a
- noNavigator :: a -> ContextNavigator a
- navigator :: Uniplate a => a -> ContextNavigator a
- termNavigator :: IsTerm a => a -> ContextNavigator a
- contextView :: View (Context a) (a, Context a)
- liftToContext :: LiftView f => f a -> f (Context a)
- applyTop :: (a -> a) -> Context a -> Context a
- use :: (LiftView f, IsTerm a, IsTerm b) => f a -> f (Context b)
- useC :: (LiftView f, IsTerm a, IsTerm b) => f (Context a) -> f (Context b)
- currentTerm :: Context a -> Maybe Term
- changeTerm :: (Term -> Maybe Term) -> Context a -> Maybe (Context a)
- currentInContext :: Context a -> Maybe a
- changeInContext :: (a -> a) -> Context a -> Context a
- replaceInContext :: a -> Context a -> Context a
- class MakeTrans f where
- data Trans a b
- type Transformation a = Trans a a
- transPure :: (a -> b) -> Trans a b
- transMaybe :: (a -> Maybe b) -> Trans a b
- transList :: (a -> [b]) -> Trans a b
- transGuard :: (a -> Bool) -> Trans a a
- transRewrite :: RewriteRule a -> Trans a a
- readRef :: Ref a -> Trans x a
- readRefDefault :: a -> Ref a -> Trans x a
- readRefMaybe :: Ref a -> Trans x (Maybe a)
- writeRef :: Ref a -> Trans a a
- writeRef_ :: Ref a -> Trans a ()
- writeRefMaybe :: Ref a -> Trans (Maybe a) ()
- transUseEnvironment :: Trans a b -> Trans (a, Environment) (b, Environment)
- transLiftView :: View a b -> Transformation b -> Transformation a
- transLiftViewIn :: View a (b, c) -> Transformation b -> Transformation a
- transLiftContext :: Transformation a -> Transformation (Context a)
- transLiftContextIn :: Transformation (a, Environment) -> Transformation (Context a)
- transApply :: Trans a b -> a -> [(b, Environment)]
- transApplyWith :: Environment -> Trans a b -> a -> [(b, Environment)]
- getRewriteRules :: Trans a b -> [Some RewriteRule]
- data Recognizer a
- class Recognizable f where
- makeRecognizer :: (a -> a -> Bool) -> Recognizer a
- makeRecognizerTrans :: Trans (a, a) () -> Recognizer a
- data Rule a
- transformation :: Rule a -> Transformation a
- checkReferences :: Rule a -> Environment -> Maybe String
- makeRule :: (IsId n, MakeTrans f) => n -> (a -> f a) -> Rule a
- ruleMaybe :: IsId n => n -> (a -> Maybe a) -> Rule a
- ruleList :: IsId n => n -> (a -> [a]) -> Rule a
- ruleTrans :: IsId n => n -> Transformation a -> Rule a
- ruleRewrite :: RewriteRule a -> Rule a
- rewriteRule :: (IsId n, RuleBuilder f a) => n -> f -> Rule a
- rewriteRules :: (IsId n, RuleBuilder f a) => n -> [f] -> Rule a
- buggyRule :: (IsId n, MakeTrans f) => n -> (a -> f a) -> Rule a
- minorRule :: (IsId n, MakeTrans f) => n -> (a -> f a) -> Rule a
- emptyRule :: IsId n => n -> Rule a
- idRule :: IsId n => n -> Rule a
- checkRule :: IsId n => n -> (a -> Bool) -> Rule a
- isRewriteRule :: Rule a -> Bool
- siblingOf :: HasId b => b -> Rule a -> Rule a
- doAfter :: (a -> a) -> Rule a -> Rule a
- addRecognizer :: Recognizer a -> Rule a -> Rule a
- addRecognizerBool :: (a -> a -> Bool) -> Rule a -> Rule a
- addTransRecognizer :: (a -> a -> Bool) -> Rule a -> Rule a
- type ParamTrans i a = Trans (i, a) a
- input :: Ref i -> Trans (i, a) b -> Trans a b
- inputWith :: Trans a i -> Trans (i, a) b -> Trans a b
- transInput1 :: Ref i -> (i -> a -> Maybe b) -> Trans a b
- transInput2 :: Ref i1 -> Ref i2 -> (i1 -> i2 -> a -> Maybe b) -> Trans a b
- transInput3 :: Ref i1 -> Ref i2 -> Ref i3 -> (i1 -> i2 -> i3 -> a -> Maybe b) -> Trans a b
- transInputWith :: MakeTrans f => Trans a i -> (i -> a -> f b) -> Trans a b
- readRef2 :: Ref a -> Ref b -> Trans x (a, b)
- readRef3 :: Ref a -> Ref b -> Ref c -> Trans x (a, b, c)
- output :: Ref o -> Trans a (b, o) -> Trans a b
- outputWith :: Trans o x -> Trans a (b, o) -> Trans a b
- outputOnly :: Ref o -> Trans a o -> Trans a a
- outputOnly2 :: Ref o1 -> Ref o2 -> Trans a (o1, o2) -> Trans a a
- outputOnly3 :: Ref o1 -> Ref o2 -> Ref o3 -> Trans a (o1, o2, o3) -> Trans a a
- outputOnlyWith :: Trans o x -> Trans a o -> Trans a a
- writeRef2 :: Ref a -> Ref b -> Trans (a, b) (a, b)
- writeRef2_ :: Ref a -> Ref b -> Trans (a, b) ()
- writeRef3 :: Ref a -> Ref b -> Ref c -> Trans (a, b, c) (a, b, c)
- writeRef3_ :: Ref a -> Ref b -> Ref c -> Trans (a, b, c) ()
- parameter1 :: Ref a -> (a -> b -> Maybe b) -> ParamTrans a b
- parameter2 :: Ref a -> Ref b -> (a -> b -> c -> Maybe c) -> ParamTrans (a, b) c
- parameter3 :: Ref a -> Ref b -> Ref c -> (a -> b -> c -> d -> Maybe d) -> ParamTrans (a, b, c) d
- transRef :: Ref a -> Trans a a
- supplyParameters :: ParamTrans b a -> Trans a b -> Transformation (Context a)
- data Path
- data Prefix a
- noPrefix :: Prefix a
- isEmptyPrefix :: Prefix a -> Bool
- majorPrefix :: Prefix a -> Prefix a
- prefixPaths :: Prefix a -> [Path]
- emptyPath :: Path
- readPath :: Monad m => String -> m Path
- readPaths :: Monad m => String -> m [Path]
- data LabeledStrategy a
- class IsStrategy f where
- data Strategy a
- label :: (IsId l, IsStrategy f) => l -> f a -> LabeledStrategy a
- emptyPrefix :: IsStrategy f => f a -> a -> Prefix a
- replayPath :: IsStrategy f => Path -> f a -> a -> ([Rule a], Prefix a)
- replayPaths :: IsStrategy f => [Path] -> f a -> a -> Prefix a
- replayStrategy :: (Monad m, IsStrategy f) => Path -> f a -> a -> m (a, Prefix a)
- derivationList :: IsStrategy f => (Rule a -> Rule a -> Ordering) -> f a -> a -> [Derivation (Rule a, Environment) a]
- rulesInStrategy :: IsStrategy f => f a -> [Rule a]
- cleanUpStrategy :: (a -> a) -> LabeledStrategy a -> LabeledStrategy a
- cleanUpStrategyAfter :: (a -> a) -> LabeledStrategy a -> LabeledStrategy a
- checkLocation :: Id -> LabeledStrategy a -> Bool
- subTaskLocation :: LabeledStrategy a -> Id -> Id -> Id
- nextTaskLocation :: LabeledStrategy a -> Id -> Id -> Id
- strategyLocations :: LabeledStrategy a -> [([Int], Id)]
- data ConfigAction
- data StrategyCfg
- byName :: HasId a => ConfigAction -> a -> StrategyCfg
- configure :: StrategyCfg -> LabeledStrategy a -> LabeledStrategy a
- configureS :: StrategyCfg -> Strategy a -> Strategy a
- isConfigId :: HasId a => a -> Bool
- remove :: IsStrategy f => f a -> Strategy a
- collapse :: IsStrategy f => f a -> Strategy a
- hide :: IsStrategy f => f a -> Strategy a
- multi :: (IsId l, IsStrategy f) => l -> f a -> Strategy a
- type DependencyGraph node key = [(node, key, [key])]
- (.*.) :: (IsStrategy f, IsStrategy g) => f a -> g a -> Strategy a
- (.|.) :: (IsStrategy f, IsStrategy g) => f a -> g a -> Strategy a
- (.%.) :: (IsStrategy f, IsStrategy g) => f a -> g a -> Strategy a
- (.@.) :: (IsStrategy f, IsStrategy g) => f a -> g a -> Strategy a
- (!~>) :: IsStrategy f => Rule a -> f a -> Strategy a
- inits :: IsStrategy f => f a -> Strategy a
- succeed :: Strategy a
- atomic :: IsStrategy f => f a -> Strategy a
- choice :: IsStrategy f => [f a] -> Strategy a
- preference :: IsStrategy f => [f a] -> Strategy a
- orelse :: IsStrategy f => [f a] -> Strategy a
- interleave :: IsStrategy f => [f a] -> Strategy a
- permute :: IsStrategy f => [f a] -> Strategy a
- many :: IsStrategy f => f a -> Strategy a
- many1 :: IsStrategy f => f a -> Strategy a
- option :: IsStrategy f => f a -> Strategy a
- check :: (a -> Bool) -> Strategy a
- repeat1 :: IsStrategy f => f a -> Strategy a
- try :: IsStrategy f => f a -> Strategy a
- (./.) :: (IsStrategy f, IsStrategy g) => f a -> g a -> Strategy a
- (|>) :: (IsStrategy f, IsStrategy g) => f a -> g a -> Strategy a
- while :: IsStrategy f => (a -> Bool) -> f a -> Strategy a
- exhaustive :: IsStrategy f => [f a] -> Strategy a
- dynamic :: (IsId n, IsStrategy f, IsTerm a) => n -> (a -> f a) -> Strategy a
- dependencyGraph :: (IsStrategy f, Ord key) => DependencyGraph (f a) key -> Strategy a
- data Option a
- layer :: (IsStrategy f, Navigator a) => [Option a] -> f a -> Strategy a
- traverse :: (IsStrategy f, Navigator a) => [Option a] -> f a -> Strategy a
- topdown :: Option a
- bottomup :: Option a
- leftToRight :: Option a
- rightToLeft :: Option a
- leftmost :: Option a
- rightmost :: Option a
- traversalFilter :: (a -> Bool) -> Option a
- parentFilter :: Navigator a => (a -> [Int]) -> Option a
- fulltd :: (IsStrategy f, Navigator a) => f a -> Strategy a
- fullbu :: (IsStrategy f, Navigator a) => f a -> Strategy a
- oncetd :: (IsStrategy f, Navigator a) => f a -> Strategy a
- oncetdPref :: (IsStrategy f, Navigator a) => f a -> Strategy a
- oncebu :: (IsStrategy f, Navigator a) => f a -> Strategy a
- oncebuPref :: (IsStrategy f, Navigator a) => f a -> Strategy a
- leftmostbu :: (IsStrategy f, Navigator a) => f a -> Strategy a
- leftmosttd :: (IsStrategy f, Navigator a) => f a -> Strategy a
- somewhere :: (IsStrategy f, Navigator a) => f a -> Strategy a
- somewhereWhen :: (IsStrategy g, Navigator a) => (a -> Bool) -> g a -> Strategy a
- innermost :: (IsStrategy f, Navigator a) => f a -> Strategy a
- outermost :: (IsStrategy f, Navigator a) => f a -> Strategy a
- ruleUp :: Navigator a => Rule a
- ruleDown :: Navigator a => Rule a
- ruleDownLast :: Navigator a => Rule a
- ruleLeft :: Navigator a => Rule a
- ruleRight :: Navigator a => Rule a
- alternatives :: IsStrategy f => [f a] -> Strategy a
- data Status
- data Exercise a = NewExercise {
- exerciseId :: Id
- status :: Status
- parser :: String -> Either String a
- prettyPrinter :: a -> String
- equivalence :: Context a -> Context a -> Bool
- similarity :: Context a -> Context a -> Bool
- suitable :: Predicate a
- ready :: Predicate a
- strategy :: LabeledStrategy (Context a)
- canBeRestarted :: Bool
- extraRules :: [Rule (Context a)]
- ruleOrdering :: Rule (Context a) -> Rule (Context a) -> Ordering
- constraints :: [Constraint (Context a)]
- navigation :: a -> ContextNavigator a
- examples :: Examples a
- hasTermView :: Maybe (View Term a)
- hasTypeable :: Maybe (IsTypeable a)
- properties :: Map Id (Dynamic a)
- emptyExercise :: Exercise a
- makeExercise :: (Show a, Eq a, IsTerm a) => Exercise a
- prettyPrinterContext :: Exercise a -> Context a -> String
- isReady :: Exercise a -> a -> Bool
- isSuitable :: Exercise a -> a -> Bool
- ruleset :: Exercise a -> [Rule (Context a)]
- getRule :: Monad m => Exercise a -> Id -> m (Rule (Context a))
- ruleOrderingWith :: HasId b => [b] -> Rule a -> Rule a -> Ordering
- violations :: Exercise a -> Context a -> [(Constraint (Context a), String)]
- isPublic :: Exercise a -> Bool
- isPrivate :: Exercise a -> Bool
- examplesContext :: Exercise a -> Examples (Context a)
- examplesAsList :: Exercise a -> [a]
- randomTerm :: QCGen -> Exercise a -> Maybe Difficulty -> Maybe a
- randomTerms :: QCGen -> Exercise a -> Maybe Difficulty -> [a]
- testGenerator :: Exercise a -> Maybe (Gen a)
- inContext :: Exercise a -> a -> Context a
- withoutContext :: (a -> a -> Bool) -> Context a -> Context a -> Bool
- useTypeable :: Typeable a => Maybe (IsTypeable a)
- setProperty :: (IsId n, Typeable val) => n -> val -> Exercise a -> Exercise a
- setPropertyF :: (IsId n, Typeable f) => n -> f a -> Exercise a -> Exercise a
- getProperty :: (IsId n, Typeable val) => n -> Exercise a -> Maybe val
- getPropertyF :: (IsId n, Typeable f) => n -> Exercise a -> Maybe (f a)
- showDerivation :: Exercise a -> a -> String
- showDerivations :: Exercise a -> a -> String
- printDerivation :: Exercise a -> a -> IO ()
- printDerivations :: Exercise a -> a -> IO ()
- diffEnvironment :: HasEnvironment a => Derivation s a -> Derivation (s, Environment) a
- defaultDerivation :: Exercise a -> a -> Maybe (Derivation (Rule (Context a), Environment) (Context a))
- allDerivations :: Exercise a -> a -> [Derivation (Rule (Context a), Environment) (Context a)]
- failS :: Strategy a
- notS :: IsStrategy f => f a -> Strategy a
- repeatS :: IsStrategy f => f a -> Strategy a
- replicateS :: IsStrategy f => Int -> f a -> Strategy a
- sequenceS :: IsStrategy f => [f a] -> Strategy a
- untilS :: IsStrategy f => (a -> Bool) -> f a -> Strategy a
- data Some f = Some (f a)
Documentation
class Category a => Arrow (a :: * -> * -> *) where #
The basic arrow class.
Instances should satisfy the following laws:
arr
id =id
arr
(f >>> g) =arr
f >>>arr
gfirst
(arr
f) =arr
(first
f)first
(f >>> g) =first
f >>>first
gfirst
f >>>arr
fst
=arr
fst
>>> ffirst
f >>>arr
(id
*** g) =arr
(id
*** g) >>>first
ffirst
(first
f) >>>arr
assoc
=arr
assoc
>>>first
f
where
assoc ((a,b),c) = (a,(b,c))
The other combinators have sensible default definitions, which may be overridden for efficiency.
Lift a function to an arrow.
first :: a b c -> a (b, d) (c, d) #
Send the first component of the input through the argument arrow, and copy the rest unchanged to the output.
second :: a b c -> a (d, b) (d, c) #
A mirror image of first
.
The default definition may be overridden with a more efficient version if desired.
(***) :: a b c -> a b' c' -> a (b, b') (c, c') infixr 3 #
Split the input between the two argument arrows and combine their output. Note that this is in general not a functor.
The default definition may be overridden with a more efficient version if desired.
(&&&) :: a b c -> a b c' -> a b (c, c') infixr 3 #
Fanout: send the input to both argument arrows and combine their output.
The default definition may be overridden with a more efficient version if desired.
Instances
Arrow Isomorphism # | |
Defined in Ideas.Common.View arr :: (b -> c) -> Isomorphism b c # first :: Isomorphism b c -> Isomorphism (b, d) (c, d) # second :: Isomorphism b c -> Isomorphism (d, b) (d, c) # (***) :: Isomorphism b c -> Isomorphism b' c' -> Isomorphism (b, b') (c, c') # (&&&) :: Isomorphism b c -> Isomorphism b c' -> Isomorphism b (c, c') # | |
Arrow View # | |
Arrow Matcher # | |
Arrow Trans # | |
Monad m => Arrow (Kleisli m) | Since: base-2.1 |
Arrow ((->) :: * -> * -> *) | Since: base-2.1 |
class ArrowZero a => ArrowPlus (a :: * -> * -> *) where #
A monoid on arrows.
class Arrow a => ArrowChoice (a :: * -> * -> *) where #
Choice, for arrows that support it. This class underlies the
if
and case
constructs in arrow notation.
Instances should satisfy the following laws:
left
(arr
f) =arr
(left
f)left
(f >>> g) =left
f >>>left
gf >>>
arr
Left
=arr
Left
>>>left
fleft
f >>>arr
(id
+++ g) =arr
(id
+++ g) >>>left
fleft
(left
f) >>>arr
assocsum
=arr
assocsum
>>>left
f
where
assocsum (Left (Left x)) = Left x assocsum (Left (Right y)) = Right (Left y) assocsum (Right z) = Right (Right z)
The other combinators have sensible default definitions, which may be overridden for efficiency.
left :: a b c -> a (Either b d) (Either c d) #
Feed marked inputs through the argument arrow, passing the rest through unchanged to the output.
right :: a b c -> a (Either d b) (Either d c) #
A mirror image of left
.
The default definition may be overridden with a more efficient version if desired.
(+++) :: a b c -> a b' c' -> a (Either b b') (Either c c') infixr 2 #
Split the input between the two argument arrows, retagging and merging their outputs. Note that this is in general not a functor.
The default definition may be overridden with a more efficient version if desired.
(|||) :: a b d -> a c d -> a (Either b c) d infixr 2 #
Fanin: Split the input between the two argument arrows and merge their outputs.
The default definition may be overridden with a more efficient version if desired.
Instances
ArrowChoice Isomorphism # | |
Defined in Ideas.Common.View left :: Isomorphism b c -> Isomorphism (Either b d) (Either c d) # right :: Isomorphism b c -> Isomorphism (Either d b) (Either d c) # (+++) :: Isomorphism b c -> Isomorphism b' c' -> Isomorphism (Either b b') (Either c c') # (|||) :: Isomorphism b d -> Isomorphism c d -> Isomorphism (Either b c) d # | |
ArrowChoice View # | |
ArrowChoice Matcher # | |
ArrowChoice Trans # | |
Monad m => ArrowChoice (Kleisli m) | Since: base-2.1 |
Defined in Control.Arrow | |
ArrowChoice ((->) :: * -> * -> *) | Since: base-2.1 |
Instances
Fix (Process a) Source # | |
Fix (Strategy a) Source # | |
Fix (CyclicTree a b) Source # | |
Defined in Ideas.Common.Strategy.CyclicTree fix :: (CyclicTree a b -> CyclicTree a b) -> CyclicTree a b Source # |
class BiFunctor f where Source #
biMap :: (a -> c) -> (b -> d) -> f a b -> f c d Source #
Instances
BiFunctor Either Source # | |
BiFunctor (,) Source # | |
BiFunctor CyclicTree Source # | |
Defined in Ideas.Common.Strategy.CyclicTree biMap :: (a -> c) -> (b -> d) -> CyclicTree a b -> CyclicTree c d Source # mapFirst :: (a -> b) -> CyclicTree a c -> CyclicTree b c Source # mapSecond :: (b -> c) -> CyclicTree a b -> CyclicTree a c Source # | |
BiFunctor Derivation Source # | |
Defined in Ideas.Common.Derivation biMap :: (a -> c) -> (b -> d) -> Derivation a b -> Derivation c d Source # mapFirst :: (a -> b) -> Derivation a c -> Derivation b c Source # mapSecond :: (b -> c) -> Derivation a b -> Derivation a c Source # | |
BiFunctor DerivationTree Source # | |
Defined in Ideas.Common.DerivationTree biMap :: (a -> c) -> (b -> d) -> DerivationTree a b -> DerivationTree c d Source # mapFirst :: (a -> b) -> DerivationTree a c -> DerivationTree b c Source # mapSecond :: (b -> c) -> DerivationTree a b -> DerivationTree a c Source # |
class Arrow arr => BiArrow arr where Source #
Type class for bi-directional arrows. -
should be used instead of
arr
from the arrow interface. Minimal complete definition: -
.
Instances
BiArrow Isomorphism Source # | |
Defined in Ideas.Common.View (<->) :: (a -> b) -> (b -> a) -> Isomorphism a b Source # (!->) :: (a -> b) -> Isomorphism a b Source # (<-!) :: (b -> a) -> Isomorphism a b Source # | |
BiArrow View Source # | |
class Container f where Source #
Instances should satisfy the following law: getSingleton . singleton == Just
A type class for functors that can be applied to a value. Transformation, Rule, and Strategy are all instances of this type class.
Instances
Apply RewriteRule Source # | |
Defined in Ideas.Common.Rewriting.RewriteRule applyAll :: RewriteRule a -> a -> [a] Source # | |
Apply Rule Source # | |
Defined in Ideas.Common.Rule.Abstract | |
Apply Dynamic Source # | |
Defined in Ideas.Common.Strategy.StrategyTree | |
Apply Leaf Source # | |
Defined in Ideas.Common.Strategy.StrategyTree | |
Apply LabeledStrategy Source # | |
Defined in Ideas.Common.Strategy.Abstract applyAll :: LabeledStrategy a -> a -> [a] Source # | |
Apply Strategy Source # | |
Defined in Ideas.Common.Strategy.Abstract | |
Apply Exercise Source # | |
Defined in Ideas.Common.Exercise |
applicable :: Apply t => t a -> a -> Bool Source #
Checks whether the functor is applicable (at least one result)
applyM :: (Apply t, Monad m) => t a -> a -> m a Source #
Same as apply, except that the result (at most one) is returned in some monad
equivalent :: Boolean a => a -> a -> a Source #
Type classfor accessing (and changing) the identifier of an entity.
Instances
class HasId a => Identify a where Source #
Type class for labeling entities with an identifier
Instances
Identify (Predicate a) Source # | |
Identify (Isomorphism a b) Source # | |
Defined in Ideas.Common.View (@>) :: IsId n => n -> Isomorphism a b -> Isomorphism a b Source # | |
Identify (View a b) Source # | |
Type class IsId
for constructing identifiers. Examples are
newId "algebra.equation"
, newId ("a", "b", "c")
, and newId ()
for the empty identifier.
Abstract data type for identifiers with a hierarchical name, carrying a description. The data type provides a fast comparison implementation.
(#) :: (IsId a, IsId b) => a -> b -> Id infixr 8 Source #
Appends two identifiers. Both parameters are overloaded.
unqualified :: HasId a => a -> String Source #
Get the unqualified part of the identifier (i.e., last string).
qualifiers :: HasId a => a -> [String] Source #
Get the list of qualifiers of the identifier (i.e., everything but the last string).
qualification :: HasId a => a -> String Source #
Get the qualified part of the identifier. If the identifier consists of
more than one part, the parts are separated by a period (
)..
description :: HasId a => a -> String Source #
Get the current description.
describe :: HasId a => String -> a -> a Source #
Give a description for the current entity. If there already is a description, both strings are combined.
compareId :: HasId a => a -> a -> Ordering Source #
Compare two identifiers based on their names. Use compare
for a fast
ordering based on hash values.
data ViewPackage where Source #
ViewPackage :: (Show a, Show b, Eq a) => (String -> Maybe a) -> View a b -> ViewPackage |
Instances
HasId ViewPackage Source # | |
Defined in Ideas.Common.View getId :: ViewPackage -> Id Source # changeId :: (Id -> Id) -> ViewPackage -> ViewPackage Source # |
class LiftView f where Source #
Instances
LiftView Constraint Source # | |
Defined in Ideas.Common.Constraint liftView :: View a b -> Constraint b -> Constraint a Source # liftViewIn :: View a (b, c) -> Constraint b -> Constraint a Source # | |
LiftView Recognizer Source # | |
Defined in Ideas.Common.Rule.Recognizer liftView :: View a b -> Recognizer b -> Recognizer a Source # liftViewIn :: View a (b, c) -> Recognizer b -> Recognizer a Source # | |
LiftView Rule Source # | |
LiftView Dynamic Source # | |
LiftView Leaf Source # | |
LiftView LabeledStrategy Source # | |
Defined in Ideas.Common.Strategy.Abstract liftView :: View a b -> LabeledStrategy b -> LabeledStrategy a Source # liftViewIn :: View a (b, c) -> LabeledStrategy b -> LabeledStrategy a Source # | |
LiftView Strategy Source # | |
data Isomorphism a b Source #
Instances
class IsMatcher f => IsView f where Source #
Minimal complete definition: toView
or both match
and build
.
makeMatcher :: (a -> Maybe b) -> Matcher a b Source #
canonicalWith :: IsView f => (b -> b) -> f a b -> a -> Maybe a Source #
simplifyWith :: IsView f => (b -> b) -> f a b -> a -> a Source #
simplifyWithM :: IsView f => (b -> Maybe b) -> f a b -> a -> a Source #
matcherView :: Matcher a b -> (b -> a) -> View a b Source #
inverse :: Isomorphism a b -> Isomorphism b a Source #
swapView :: Isomorphism (a, b) (b, a) Source #
traverseView :: Traversable f => View a b -> View (f a) (f b) Source #
predicateView :: View a b -> Predicate a Source #
evalPredicate :: Predicate a -> a -> Bool Source #
data Difficulty Source #
Instances
examplesFor :: Difficulty -> [a] -> Examples a Source #
List of examples with the same difficulty
examplesWithDifficulty :: [(Difficulty, a)] -> Examples a Source #
List of examples with their own difficulty
readDifficulty :: String -> Maybe Difficulty Source #
Parser for difficulty levels, which ignores non-alpha charactes (including spaces) and upper/lower case distinction.
data Constraint a Source #
Instances
makeConstraint :: IsId n => n -> (a -> Result ()) -> Constraint a Source #
isRelevant :: Constraint a -> a -> Bool Source #
isSatisfied :: Constraint a -> a -> Bool Source #
Satisfaction condition
isViolated :: Constraint a -> a -> Maybe String Source #
Satisfaction condition
toLocation :: [Int] -> Location Source #
class WithMetaVars a where Source #
class WithFunctions a where Source #
toTermList :: [a] -> Term Source #
fromTerm :: MonadPlus m => Term -> m a Source #
fromTermList :: MonadPlus m => Term -> m [a] Source #
Instances
makeAssociative :: Symbol -> Symbol Source #
trueSymbol :: Symbol Source #
falseSymbol :: Symbol Source #
isFunction :: (WithFunctions a, Monad m) => Symbol -> a -> m [a] Source #
unary :: WithFunctions a => Symbol -> a -> a Source #
binary :: WithFunctions a => Symbol -> a -> a -> a Source #
ternary :: WithFunctions a => Symbol -> a -> a -> a -> a Source #
isVariable :: WithVars a => a -> Bool Source #
isMetaVar :: WithMetaVars a => a -> Bool Source #
metaVarSet :: (Uniplate a, WithMetaVars a) => a -> IntSet Source #
hasMetaVar :: (Uniplate a, WithMetaVars a) => Int -> a -> Bool Source #
nextMetaVar :: (Uniplate a, WithMetaVars a) => a -> Int Source #
class HasRefs a where Source #
Instances
HasRefs Environment Source # | |
Defined in Ideas.Common.Environment | |
HasRefs (Recognizer a) Source # | |
Defined in Ideas.Common.Rule.Recognizer | |
HasRefs (Rule a) Source # | |
HasRefs (Trans a b) Source # | |
class HasEnvironment env where Source #
environment :: env -> Environment Source #
setEnvironment :: Environment -> env -> env Source #
deleteRef :: Ref a -> env -> env Source #
Instances
HasEnvironment Environment Source # | |
Defined in Ideas.Common.Environment environment :: Environment -> Environment Source # setEnvironment :: Environment -> Environment -> Environment Source # deleteRef :: Ref a -> Environment -> Environment Source # insertRef :: Ref a -> a -> Environment -> Environment Source # changeRef :: Ref a -> (a -> a) -> Environment -> Environment Source # | |
HasEnvironment (Context a) Source # | |
Defined in Ideas.Common.Context | |
HasEnvironment (State a) Source # | |
Defined in Ideas.Service.State |
data Environment Source #
Instances
class (IsTerm a, Typeable a, Show a, Read a) => Reference a where Source #
A type class for types as references
Instances
Reference Char Source # | |
Reference Int Source # | |
Reference ShowString Source # | |
Defined in Ideas.Common.Environment makeRef :: IsId n => n -> Ref ShowString Source # makeRefList :: IsId n => n -> Ref [ShowString] Source # | |
Reference Term Source # | |
Reference a => Reference [a] Source # | |
(Reference a, Reference b) => Reference (a, b) Source # | |
A data type for references (without a value)
makeBinding :: Ref a -> a -> Binding Source #
getTermValue :: Binding -> Term Source #
makeEnvironment :: [Binding] -> Environment Source #
singleBinding :: Ref a -> a -> Environment Source #
bindings :: HasEnvironment env => env -> [Binding] Source #
noBindings :: HasEnvironment env => env -> Bool Source #
class (IsTerm a, Show a) => RuleBuilder t a | t -> a where Source #
Instances
(IsTerm a, Show a) => RuleBuilder (RuleSpec a) a Source # | |
Defined in Ideas.Common.Rewriting.RewriteRule | |
(Different a, RuleBuilder t b) => RuleBuilder (a -> t) b Source # | |
Defined in Ideas.Common.Rewriting.RewriteRule |
class Different a where Source #
Instances
Different Bool Source # | |
Different Char Source # | |
Different Double Source # | |
Different Float Source # | |
Different Int Source # | |
Different Integer Source # | |
Different Rational Source # | |
Different Term Source # | |
Different a => Different [a] Source # | |
Defined in Ideas.Common.Rewriting.RewriteRule | |
(Different a, Different b) => Different (a, b) Source # | |
Defined in Ideas.Common.Rewriting.RewriteRule | |
(Different a, Different b, Different c) => Different (a, b, c) Source # | |
Defined in Ideas.Common.Rewriting.RewriteRule |
data RewriteRule a Source #
Instances
Apply RewriteRule Source # | |
Defined in Ideas.Common.Rewriting.RewriteRule applyAll :: RewriteRule a -> a -> [a] Source # | |
IsStrategy RewriteRule Source # | |
Defined in Ideas.Common.Strategy.Abstract toStrategy :: RewriteRule a -> Strategy a Source # | |
Show (RewriteRule a) Source # | |
Defined in Ideas.Common.Rewriting.RewriteRule showsPrec :: Int -> RewriteRule a -> ShowS # show :: RewriteRule a -> String # showList :: [RewriteRule a] -> ShowS # | |
HasId (RewriteRule a) Source # | |
Defined in Ideas.Common.Rewriting.RewriteRule getId :: RewriteRule a -> Id Source # changeId :: (Id -> Id) -> RewriteRule a -> RewriteRule a Source # |
a :~> a infixl 1 |
makeRewriteRule :: (IsId n, RuleBuilder f a) => n -> f -> RewriteRule a Source #
termRewriteRule :: (IsId n, IsTerm a, Show a) => n -> RuleSpec Term -> RewriteRule a Source #
symbolMatcher :: Symbol -> SymbolMatch -> RewriteRule a -> RewriteRule a Source #
symbolBuilder :: Symbol -> ([Term] -> Term) -> RewriteRule a -> RewriteRule a Source #
showRewriteRule :: Bool -> RewriteRule a -> Maybe String Source #
metaInRewriteRule :: RewriteRule a -> [Int] Source #
renumberRewriteRule :: Int -> RewriteRule a -> RewriteRule a Source #
data Derivation s a Source #
Instances
emptyDerivation :: a -> Derivation s a Source #
prepend :: (a, s) -> Derivation s a -> Derivation s a Source #
extend :: Derivation s a -> (s, a) -> Derivation s a Source #
merge :: Eq a => Derivation s a -> Derivation s a -> Maybe (Derivation s a) Source #
mergeBy :: (a -> a -> Bool) -> Derivation s a -> Derivation s a -> Maybe (Derivation s a) Source #
mergeStep :: Derivation s a -> s -> Derivation s a -> Derivation s a Source #
derivationToList :: (s -> b) -> (a -> b) -> Derivation s a -> [b] Source #
derivationFromList :: Monad m => (b -> m s) -> (b -> m a) -> [b] -> m (Derivation s a) Source #
isEmpty :: Derivation s a -> Bool Source #
Tests whether the derivation is empty
derivationLength :: Derivation s a -> Int Source #
Returns the number of steps in a derivation
terms :: Derivation s a -> [a] Source #
All terms in a derivation
steps :: Derivation s a -> [s] Source #
All steps in a derivation
triples :: Derivation s a -> [(a, s, a)] Source #
The triples of a derivation, consisting of the before term, the step, and the after term.
firstTerm :: Derivation s a -> a Source #
lastTerm :: Derivation s a -> a Source #
lastStep :: Derivation s a -> Maybe s Source #
withoutLast :: Derivation s a -> Derivation s a Source #
updateSteps :: (a -> s -> a -> t) -> Derivation s a -> Derivation t a Source #
derivationM :: Monad m => (s -> m ()) -> (a -> m ()) -> Derivation s a -> m () Source #
Apply a monadic function to each term, and to each step
splitStep :: (s -> Bool) -> Derivation s a -> Maybe (Derivation s a, s, Derivation s a) Source #
data ContextNavigator a Source #
Abstract data type for a context: a context stores an environment.
fromContext :: Monad m => Context a -> m a Source #
fromContextWith :: Monad m => (a -> b) -> Context a -> m b Source #
newContext :: ContextNavigator a -> Context a Source #
Construct a context
noNavigator :: a -> ContextNavigator a Source #
navigator :: Uniplate a => a -> ContextNavigator a Source #
termNavigator :: IsTerm a => a -> ContextNavigator a Source #
liftToContext :: LiftView f => f a -> f (Context a) Source #
Lift a rule to operate on a term in a context
applyTop :: (a -> a) -> Context a -> Context a Source #
Apply a function at top-level. Afterwards, try to return the focus to the old position
currentInContext :: Context a -> Maybe a Source #
changeInContext :: (a -> a) -> Context a -> Context a Source #
replaceInContext :: a -> Context a -> Context a Source #
class MakeTrans f where Source #
A type class for constructing a transformation. If possible, makeTrans
should be used. Use specialized constructor functions for disambiguation.
Instances
Arrow Trans Source # | |
ArrowZero Trans Source # | |
Defined in Ideas.Common.Rule.Transformation | |
ArrowPlus Trans Source # | |
ArrowChoice Trans Source # | |
Functor (Trans a) Source # | |
Applicative (Trans a) Source # | |
Alternative (Trans a) Source # | |
Category Trans Source # | |
Semigroup (Trans a b) Source # | |
Monoid (Trans a b) Source # | |
HasRefs (Trans a b) Source # | |
type Transformation a = Trans a a Source #
transMaybe :: (a -> Maybe b) -> Trans a b Source #
transGuard :: (a -> Bool) -> Trans a a Source #
transRewrite :: RewriteRule a -> Trans a a Source #
readRefDefault :: a -> Ref a -> Trans x a Source #
transUseEnvironment :: Trans a b -> Trans (a, Environment) (b, Environment) Source #
transLiftView :: View a b -> Transformation b -> Transformation a Source #
transLiftViewIn :: View a (b, c) -> Transformation b -> Transformation a Source #
transLiftContext :: Transformation a -> Transformation (Context a) Source #
transLiftContextIn :: Transformation (a, Environment) -> Transformation (Context a) Source #
transApply :: Trans a b -> a -> [(b, Environment)] Source #
transApplyWith :: Environment -> Trans a b -> a -> [(b, Environment)] Source #
getRewriteRules :: Trans a b -> [Some RewriteRule] Source #
data Recognizer a Source #
Instances
class Recognizable f where Source #
recognizer :: f a -> Recognizer a Source #
recognizeAll :: f a -> a -> a -> [Environment] Source #
recognize :: f a -> a -> a -> Maybe Environment Source #
recognizeTrans :: f a -> Trans (a, a) () Source #
Instances
Recognizable Recognizer Source # | |
Defined in Ideas.Common.Rule.Recognizer recognizer :: Recognizer a -> Recognizer a Source # recognizeAll :: Recognizer a -> a -> a -> [Environment] Source # recognize :: Recognizer a -> a -> a -> Maybe Environment Source # recognizeTrans :: Recognizer a -> Trans (a, a) () Source # | |
Recognizable Rule Source # | |
Defined in Ideas.Common.Rule.Abstract recognizer :: Rule a -> Recognizer a Source # recognizeAll :: Rule a -> a -> a -> [Environment] Source # recognize :: Rule a -> a -> a -> Maybe Environment Source # recognizeTrans :: Rule a -> Trans (a, a) () Source # |
makeRecognizer :: (a -> a -> Bool) -> Recognizer a Source #
makeRecognizerTrans :: Trans (a, a) () -> Recognizer a Source #
Abstract data type for representing rules
Instances
Apply Rule Source # | |
Defined in Ideas.Common.Rule.Abstract | |
LiftView Rule Source # | |
Recognizable Rule Source # | |
Defined in Ideas.Common.Rule.Abstract recognizer :: Rule a -> Recognizer a Source # recognizeAll :: Rule a -> a -> a -> [Environment] Source # recognize :: Rule a -> a -> a -> Maybe Environment Source # recognizeTrans :: Rule a -> Trans (a, a) () Source # | |
IsStrategy Rule Source # | |
Defined in Ideas.Common.Strategy.Abstract toStrategy :: Rule a -> Strategy a Source # | |
Eq (Rule a) Source # | |
Ord (Rule a) Source # | |
Show (Rule a) Source # | |
Minor (Rule a) Source # | |
Buggy (Rule a) Source # | |
HasId (Rule a) Source # | |
HasRefs (Rule a) Source # | |
LabelSymbol (Rule a) Source # | |
Defined in Ideas.Common.Strategy.Symbol isEnterSymbol :: Rule a -> Bool Source # | |
AtomicSymbol (Rule a) Source # | |
Defined in Ideas.Common.Strategy.Symbol atomicOpen :: Rule a Source # atomicClose :: Rule a Source # |
transformation :: Rule a -> Transformation a Source #
checkReferences :: Rule a -> Environment -> Maybe String Source #
ruleRewrite :: RewriteRule a -> Rule a Source #
rewriteRule :: (IsId n, RuleBuilder f a) => n -> f -> Rule a Source #
rewriteRules :: (IsId n, RuleBuilder f a) => n -> [f] -> Rule a Source #
emptyRule :: IsId n => n -> Rule a Source #
A special (minor) rule that is never applicable (i.e., this rule always fails)
checkRule :: IsId n => n -> (a -> Bool) -> Rule a Source #
A special (minor) rule that checks a predicate (and returns the identity if the predicate holds)
isRewriteRule :: Rule a -> Bool Source #
addRecognizer :: Recognizer a -> Rule a -> Rule a Source #
type ParamTrans i a = Trans (i, a) a Source #
parameter1 :: Ref a -> (a -> b -> Maybe b) -> ParamTrans a b Source #
parameter2 :: Ref a -> Ref b -> (a -> b -> c -> Maybe c) -> ParamTrans (a, b) c Source #
parameter3 :: Ref a -> Ref b -> Ref c -> (a -> b -> c -> d -> Maybe d) -> ParamTrans (a, b, c) d Source #
supplyParameters :: ParamTrans b a -> Trans a b -> Transformation (Context a) Source #
A path encodes a location in a strategy. Paths are represented as a list of integers and terms (the latter act as input for the dynamic strategies).
isEmptyPrefix :: Prefix a -> Bool Source #
majorPrefix :: Prefix a -> Prefix a Source #
Transforms the prefix such that only major steps are kept in the remaining strategy.
prefixPaths :: Prefix a -> [Path] Source #
Returns the current Path
.
data LabeledStrategy a Source #
A strategy which is labeled with an identifier
Instances
Apply LabeledStrategy Source # | |
Defined in Ideas.Common.Strategy.Abstract applyAll :: LabeledStrategy a -> a -> [a] Source # | |
LiftView LabeledStrategy Source # | |
Defined in Ideas.Common.Strategy.Abstract liftView :: View a b -> LabeledStrategy b -> LabeledStrategy a Source # liftViewIn :: View a (b, c) -> LabeledStrategy b -> LabeledStrategy a Source # | |
IsStrategy LabeledStrategy Source # | |
Defined in Ideas.Common.Strategy.Abstract toStrategy :: LabeledStrategy a -> Strategy a Source # | |
Show (LabeledStrategy a) Source # | |
Defined in Ideas.Common.Strategy.Abstract showsPrec :: Int -> LabeledStrategy a -> ShowS # show :: LabeledStrategy a -> String # showList :: [LabeledStrategy a] -> ShowS # | |
HasId (LabeledStrategy a) Source # | |
Defined in Ideas.Common.Strategy.Abstract getId :: LabeledStrategy a -> Id Source # changeId :: (Id -> Id) -> LabeledStrategy a -> LabeledStrategy a Source # |
class IsStrategy f where Source #
Type class to turn values into strategies
toStrategy :: f a -> Strategy a Source #
Instances
IsStrategy RewriteRule Source # | |
Defined in Ideas.Common.Strategy.Abstract toStrategy :: RewriteRule a -> Strategy a Source # | |
IsStrategy Rule Source # | |
Defined in Ideas.Common.Strategy.Abstract toStrategy :: Rule a -> Strategy a Source # | |
IsStrategy Dynamic Source # | |
Defined in Ideas.Common.Strategy.Abstract toStrategy :: Dynamic a -> Strategy a Source # | |
IsStrategy LabeledStrategy Source # | |
Defined in Ideas.Common.Strategy.Abstract toStrategy :: LabeledStrategy a -> Strategy a Source # | |
IsStrategy Strategy Source # | |
Defined in Ideas.Common.Strategy.Abstract toStrategy :: Strategy a -> Strategy a Source # |
Abstract data type for strategies
Instances
Apply Strategy Source # | |
Defined in Ideas.Common.Strategy.Abstract | |
LiftView Strategy Source # | |
IsStrategy Strategy Source # | |
Defined in Ideas.Common.Strategy.Abstract toStrategy :: Strategy a -> Strategy a Source # | |
Show (Strategy a) Source # | |
Fix (Strategy a) Source # | |
Choice (Strategy a) Source # | |
Defined in Ideas.Common.Strategy.Abstract | |
Sequence (Strategy a) Source # | |
Defined in Ideas.Common.Strategy.Abstract | |
type Sym (Strategy a) Source # | |
Defined in Ideas.Common.Strategy.Abstract |
label :: (IsId l, IsStrategy f) => l -> f a -> LabeledStrategy a Source #
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.
derivationList :: IsStrategy f => (Rule a -> Rule a -> Ordering) -> f a -> a -> [Derivation (Rule a, Environment) a] Source #
rulesInStrategy :: IsStrategy f => f a -> [Rule a] Source #
Returns a list of all major rules that are part of a labeled strategy
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
checkLocation :: Id -> LabeledStrategy a -> Bool Source #
subTaskLocation :: LabeledStrategy a -> Id -> Id -> Id Source #
nextTaskLocation :: LabeledStrategy a -> Id -> Id -> Id Source #
strategyLocations :: LabeledStrategy a -> [([Int], Id)] Source #
Returns a list of all strategy locations, paired with the label
data ConfigAction Source #
Instances
Eq ConfigAction Source # | |
Defined in Ideas.Common.Strategy.Configuration (==) :: ConfigAction -> ConfigAction -> Bool # (/=) :: ConfigAction -> ConfigAction -> Bool # | |
Read ConfigAction Source # | |
Defined in Ideas.Common.Strategy.Configuration readsPrec :: Int -> ReadS ConfigAction # readList :: ReadS [ConfigAction] # | |
Show ConfigAction Source # | |
Defined in Ideas.Common.Strategy.Configuration showsPrec :: Int -> ConfigAction -> ShowS # show :: ConfigAction -> String # showList :: [ConfigAction] -> ShowS # |
data StrategyCfg Source #
Instances
Show StrategyCfg Source # | |
Defined in Ideas.Common.Strategy.Configuration showsPrec :: Int -> StrategyCfg -> ShowS # show :: StrategyCfg -> String # showList :: [StrategyCfg] -> ShowS # | |
Semigroup StrategyCfg Source # | |
Defined in Ideas.Common.Strategy.Configuration (<>) :: StrategyCfg -> StrategyCfg -> StrategyCfg # sconcat :: NonEmpty StrategyCfg -> StrategyCfg # stimes :: Integral b => b -> StrategyCfg -> StrategyCfg # | |
Monoid StrategyCfg Source # | |
Defined in Ideas.Common.Strategy.Configuration mempty :: StrategyCfg # mappend :: StrategyCfg -> StrategyCfg -> StrategyCfg # mconcat :: [StrategyCfg] -> StrategyCfg # |
byName :: HasId a => ConfigAction -> a -> StrategyCfg Source #
configure :: StrategyCfg -> LabeledStrategy a -> LabeledStrategy a Source #
configureS :: StrategyCfg -> Strategy a -> Strategy a Source #
isConfigId :: HasId a => a -> Bool Source #
remove :: IsStrategy f => f a -> Strategy a Source #
collapse :: IsStrategy f => f a -> Strategy a Source #
hide :: IsStrategy f => f a -> Strategy a Source #
multi :: (IsId l, IsStrategy f) => l -> f a -> Strategy a Source #
Apply a strategy at least once, but collapse into a single step
type DependencyGraph node key = [(node, key, [key])] Source #
(.*.) :: (IsStrategy f, IsStrategy g) => f a -> g a -> Strategy a infixr 5 Source #
Put two strategies in sequence (first do this, then do that)
(.|.) :: (IsStrategy f, IsStrategy g) => f a -> g a -> Strategy a infixr 3 Source #
Choose between the two strategies (either do this or do that)
(.%.) :: (IsStrategy f, IsStrategy g) => f a -> g a -> Strategy a infixr 2 Source #
Interleave two strategies
(.@.) :: (IsStrategy f, IsStrategy g) => f a -> g a -> Strategy a infixr 2 Source #
Alternate two strategies
(!~>) :: IsStrategy f => Rule a -> f a -> Strategy a infixr 5 Source #
Prefixing a basic rule to a strategy atomically
inits :: IsStrategy f => f a -> Strategy a Source #
Initial prefixes (allows the strategy to stop succesfully at any time)
atomic :: IsStrategy f => f a -> Strategy a Source #
Makes a strategy atomic (w.r.t. parallel composition)
choice :: IsStrategy f => [f a] -> Strategy a Source #
Combines a list of alternative strategies
preference :: IsStrategy f => [f a] -> Strategy a Source #
Combines a list of strategies with left-preference
orelse :: IsStrategy f => [f a] -> Strategy a Source #
Combines a list of strategies with left-biased choice
interleave :: IsStrategy f => [f a] -> Strategy a Source #
Merges a list of strategies (in parallel)
permute :: IsStrategy f => [f a] -> Strategy a Source #
Allows all permutations of the list
many :: IsStrategy f => f a -> Strategy a Source #
Repeat a strategy zero or more times (non-greedy)
many1 :: IsStrategy f => f a -> Strategy a Source #
Apply a certain strategy at least once (non-greedy)
option :: IsStrategy f => f a -> Strategy a Source #
Apply a certain strategy or do nothing (non-greedy)
check :: (a -> Bool) -> Strategy a Source #
Checks whether a predicate holds for the current term. The check is considered to be a minor step.
repeat1 :: IsStrategy f => f a -> Strategy a Source #
Apply a certain strategy at least once (greedy version of many1
)
try :: IsStrategy f => f a -> Strategy a Source #
Apply a certain strategy if this is possible (greedy version of option
)
(./.) :: (IsStrategy f, IsStrategy g) => f a -> g a -> Strategy a infixr 4 Source #
Choose between the two strategies, with a preference for steps from the left hand-side strategy.
(|>) :: (IsStrategy f, IsStrategy g) => f a -> g a -> Strategy a infixr 4 Source #
Left-biased choice: if the left-operand strategy can be applied, do so. Otherwise, try the right-operand strategy
while :: IsStrategy f => (a -> Bool) -> f a -> Strategy a Source #
Repeat the strategy as long as the predicate holds
exhaustive :: IsStrategy f => [f a] -> Strategy a Source #
Apply the strategies from the list exhaustively (until this is no longer possible)
dynamic :: (IsId n, IsStrategy f, IsTerm a) => n -> (a -> f a) -> Strategy a Source #
The structure of a dynamic strategy depends on the current term
dependencyGraph :: (IsStrategy f, Ord key) => DependencyGraph (f a) key -> Strategy a Source #
Create a strategy from a dependency graph with strategies as nodes Does not check for cycles
leftToRight :: Option a Source #
rightToLeft :: Option a Source #
traversalFilter :: (a -> Bool) -> Option a Source #
oncetdPref :: (IsStrategy f, Navigator a) => f a -> Strategy a Source #
oncebuPref :: (IsStrategy f, Navigator a) => f a -> Strategy a Source #
leftmostbu :: (IsStrategy f, Navigator a) => f a -> Strategy a Source #
leftmosttd :: (IsStrategy f, Navigator a) => f a -> Strategy a Source #
somewhereWhen :: (IsStrategy g, Navigator a) => (a -> Bool) -> g a -> Strategy a Source #
innermost :: (IsStrategy f, Navigator a) => f a -> Strategy a Source #
left-most innermost traversal.
outermost :: (IsStrategy f, Navigator a) => f a -> Strategy a Source #
left-most outermost traversal.
ruleDownLast :: Navigator a => Rule a Source #
alternatives :: IsStrategy f => [f a] -> Strategy a Source #
The status of an exercise class.
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 |
For constructing an empty exercise, use function emptyExercise
or
makeExercise
.
NewExercise | |
|
Instances
Apply Exercise Source # | |
Defined in Ideas.Common.Exercise | |
HasTypeable Exercise Source # | |
Defined in Ideas.Common.Exercise getTypeable :: Exercise a -> Maybe (IsTypeable a) Source # | |
Eq (Exercise a) Source # | |
Ord (Exercise a) Source # | |
HasId (Exercise a) Source # | |
emptyExercise :: Exercise a Source #
The emptyExercise
constructor function provides sensible defaults for
all fields of the Exercise
record.
makeExercise :: (Show a, Eq a, IsTerm a) => Exercise a Source #
In addition to the defaults of emptyExercise
, this constructor sets
the fields prettyPrinter
, similarity
, and hasTermView
.
prettyPrinterContext :: Exercise a -> Context a -> String Source #
Pretty print a value in its context.
isSuitable :: Exercise a -> a -> Bool Source #
Checks if the expression is suitable and can be solved by the strategy.
ruleset :: Exercise a -> [Rule (Context a)] Source #
Returns a sorted list of rules, without duplicates.
getRule :: Monad m => Exercise a -> Id -> m (Rule (Context a)) Source #
Finds a rule of an exercise based on its identifier.
ruleOrderingWith :: HasId b => [b] -> Rule a -> Rule a -> Ordering Source #
Makes a rule ordering based on a list of values with identifiers (e.g., a list of rules). Rules with identifiers that are not in the list are considered after the rules in the list, and are sorted based on their identifier.
violations :: Exercise a -> Context a -> [(Constraint (Context a), String)] Source #
Get all constraint violations
examplesContext :: Exercise a -> Examples (Context a) Source #
Returns the examples of an exercise class lifted to a context.
examplesAsList :: Exercise a -> [a] Source #
randomTerm :: QCGen -> Exercise a -> Maybe Difficulty -> Maybe a Source #
Returns a random exercise of a certain difficulty with some random
number generator. The field randomExercise
is used; if this is not
defined (i.e., Nothing), one of the examples is used instead.
randomTerms :: QCGen -> Exercise a -> Maybe Difficulty -> [a] Source #
Returns a list of randomly generated terms of a certain difficulty.
testGenerator :: Exercise a -> Maybe (Gen a) Source #
An exercise generator for testing purposes (including corner cases); first generator only.
inContext :: Exercise a -> a -> Context a Source #
Puts a value into a context with an empty environment.
withoutContext :: (a -> a -> Bool) -> Context a -> Context a -> Bool Source #
Function for defining equivalence or similarity without taking the context into account.
useTypeable :: Typeable a => Maybe (IsTypeable a) Source #
Encapsulates a type representation (use for hasTypeable
field).
setProperty :: (IsId n, Typeable val) => n -> val -> Exercise a -> Exercise a Source #
Set an exercise-specific property (with a dynamic type)
setPropertyF :: (IsId n, Typeable f) => n -> f a -> Exercise a -> Exercise a Source #
Set an exercise-specific property (with a dynamic type) that is parameterized over the exercise term.
getProperty :: (IsId n, Typeable val) => n -> Exercise a -> Maybe val Source #
Get an exercise-specific property (of a dynamic type)
getPropertyF :: (IsId n, Typeable f) => n -> Exercise a -> Maybe (f a) Source #
Get an exercise-specific property (of a dynamic type) that is parameterized over the exercise term.
showDerivation :: Exercise a -> a -> String Source #
Shows the default derivation for a given start term. The specified rule ordering is used for selection.
showDerivations :: Exercise a -> a -> String Source #
Shows all derivations for a given start term. Warning: there can be many derivations.
printDerivation :: Exercise a -> a -> IO () Source #
Prints the default derivation for a given start term. The specified rule ordering is used for selection.
printDerivations :: Exercise a -> a -> IO () Source #
Prints all derivations for a given start term. Warning: there can be many derivations.
diffEnvironment :: HasEnvironment a => Derivation s a -> Derivation (s, Environment) a Source #
Adds the difference of the environments in a derivation to the steps.
Bindings with identifier location
are ignored. This utility function is
useful for printing derivations.
defaultDerivation :: Exercise a -> a -> Maybe (Derivation (Rule (Context a), Environment) (Context a)) Source #
allDerivations :: Exercise a -> a -> [Derivation (Rule (Context a), Environment) (Context a)] Source #
notS :: IsStrategy f => f a -> Strategy a Source #
Alias for strategy combinator not
repeatS :: IsStrategy f => f a -> Strategy a Source #
Alias for strategy combinator repeat
replicateS :: IsStrategy f => Int -> f a -> Strategy a Source #
Alias for strategy combinator replicate
sequenceS :: IsStrategy f => [f a] -> Strategy a Source #
Alias for strategy combinator sequence