ideas-1.8: Feedback services for intelligent tutoring systems

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

Ideas.Common.Library

Description

Exports most from package Common

Synopsis

Documentation

class Category a => Arrow (a :: * -> * -> *) where #

The basic arrow class.

Instances should satisfy the following laws:

where

assoc ((a,b),c) = (a,(b,c))

The other combinators have sensible default definitions, which may be overridden for efficiency.

Minimal complete definition

arr, (first | (***))

Methods

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

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 # 
Instance details

Defined in Ideas.Common.View

Methods

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 # 
Instance details

Defined in Ideas.Common.View

Methods

arr :: (b -> c) -> View b c #

first :: View b c -> View (b, d) (c, d) #

second :: View b c -> View (d, b) (d, c) #

(***) :: View b c -> View b' c' -> View (b, b') (c, c') #

(&&&) :: View b c -> View b c' -> View b (c, c') #

Arrow Matcher # 
Instance details

Defined in Ideas.Common.View

Methods

arr :: (b -> c) -> Matcher b c #

first :: Matcher b c -> Matcher (b, d) (c, d) #

second :: Matcher b c -> Matcher (d, b) (d, c) #

(***) :: Matcher b c -> Matcher b' c' -> Matcher (b, b') (c, c') #

(&&&) :: Matcher b c -> Matcher b c' -> Matcher b (c, c') #

Arrow Trans # 
Instance details

Defined in Ideas.Common.Rule.Transformation

Methods

arr :: (b -> c) -> Trans b c #

first :: Trans b c -> Trans (b, d) (c, d) #

second :: Trans b c -> Trans (d, b) (d, c) #

(***) :: Trans b c -> Trans b' c' -> Trans (b, b') (c, c') #

(&&&) :: Trans b c -> Trans b c' -> Trans b (c, c') #

Monad m => Arrow (Kleisli m)

Since: base-2.1

Instance details

Defined in Control.Arrow

Methods

arr :: (b -> c) -> Kleisli m b c #

first :: Kleisli m b c -> Kleisli m (b, d) (c, d) #

second :: Kleisli m b c -> Kleisli m (d, b) (d, c) #

(***) :: Kleisli m b c -> Kleisli m b' c' -> Kleisli m (b, b') (c, c') #

(&&&) :: Kleisli m b c -> Kleisli m b c' -> Kleisli m b (c, c') #

Arrow ((->) :: * -> * -> *)

Since: base-2.1

Instance details

Defined in Control.Arrow

Methods

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

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

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

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

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

class Arrow a => ArrowZero (a :: * -> * -> *) where #

Minimal complete definition

zeroArrow

Methods

zeroArrow :: a b c #

Instances
ArrowZero Matcher # 
Instance details

Defined in Ideas.Common.View

Methods

zeroArrow :: Matcher b c #

ArrowZero Trans # 
Instance details

Defined in Ideas.Common.Rule.Transformation

Methods

zeroArrow :: Trans b c #

MonadPlus m => ArrowZero (Kleisli m)

Since: base-2.1

Instance details

Defined in Control.Arrow

Methods

zeroArrow :: Kleisli m b c #

class ArrowZero a => ArrowPlus (a :: * -> * -> *) where #

A monoid on arrows.

Minimal complete definition

(<+>)

Methods

(<+>) :: a b c -> a b c -> a b c infixr 5 #

An associative operation with identity zeroArrow.

Instances
ArrowPlus Matcher # 
Instance details

Defined in Ideas.Common.View

Methods

(<+>) :: Matcher b c -> Matcher b c -> Matcher b c #

ArrowPlus Trans # 
Instance details

Defined in Ideas.Common.Rule.Transformation

Methods

(<+>) :: Trans b c -> Trans b c -> Trans b c #

MonadPlus m => ArrowPlus (Kleisli m)

Since: base-2.1

Instance details

Defined in Control.Arrow

Methods

(<+>) :: Kleisli m b c -> Kleisli m b c -> Kleisli m b c #

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:

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.

Methods

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 # 
Instance details

Defined in Ideas.Common.View

Methods

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 # 
Instance details

Defined in Ideas.Common.View

Methods

left :: View b c -> View (Either b d) (Either c d) #

right :: View b c -> View (Either d b) (Either d c) #

(+++) :: View b c -> View b' c' -> View (Either b b') (Either c c') #

(|||) :: View b d -> View c d -> View (Either b c) d #

ArrowChoice Matcher # 
Instance details

Defined in Ideas.Common.View

Methods

left :: Matcher b c -> Matcher (Either b d) (Either c d) #

right :: Matcher b c -> Matcher (Either d b) (Either d c) #

(+++) :: Matcher b c -> Matcher b' c' -> Matcher (Either b b') (Either c c') #

(|||) :: Matcher b d -> Matcher c d -> Matcher (Either b c) d #

ArrowChoice Trans # 
Instance details

Defined in Ideas.Common.Rule.Transformation

Methods

left :: Trans b c -> Trans (Either b d) (Either c d) #

right :: Trans b c -> Trans (Either d b) (Either d c) #

(+++) :: Trans b c -> Trans b' c' -> Trans (Either b b') (Either c c') #

(|||) :: Trans b d -> Trans c d -> Trans (Either b c) d #

Monad m => ArrowChoice (Kleisli m)

Since: base-2.1

Instance details

Defined in Control.Arrow

Methods

left :: Kleisli m b c -> Kleisli m (Either b d) (Either c d) #

right :: Kleisli m b c -> Kleisli m (Either d b) (Either d c) #

(+++) :: Kleisli m b c -> Kleisli m b' c' -> Kleisli m (Either b b') (Either c c') #

(|||) :: Kleisli m b d -> Kleisli m c d -> Kleisli m (Either b c) d #

ArrowChoice ((->) :: * -> * -> *)

Since: base-2.1

Instance details

Defined in Control.Arrow

Methods

left :: (b -> c) -> Either b d -> Either c d #

right :: (b -> c) -> Either d b -> Either d c #

(+++) :: (b -> c) -> (b' -> c') -> Either b b' -> Either c c' #

(|||) :: (b -> d) -> (c -> d) -> Either b c -> d #

(>>>) :: Category cat => cat a b -> cat b c -> cat a c infixr 1 #

Left-to-right composition

(<<<) :: Category cat => cat b c -> cat a b -> cat a c infixr 1 #

Right-to-left composition

class Minor a where Source #

Minimal complete definition

setMinor, isMinor

Methods

minor :: a -> a Source #

setMinor :: Bool -> a -> a Source #

isMinor :: a -> Bool Source #

isMajor :: a -> Bool Source #

Instances
Minor (Rule a) Source # 
Instance details

Defined in Ideas.Common.Rule.Abstract

Methods

minor :: Rule a -> Rule a Source #

setMinor :: Bool -> Rule a -> Rule a Source #

isMinor :: Rule a -> Bool Source #

isMajor :: Rule a -> Bool Source #

Minor (Leaf a) Source # 
Instance details

Defined in Ideas.Common.Strategy.StrategyTree

Methods

minor :: Leaf a -> Leaf a Source #

setMinor :: Bool -> Leaf a -> Leaf a Source #

isMinor :: Leaf a -> Bool Source #

isMajor :: Leaf a -> Bool Source #

class Buggy a where Source #

Minimal complete definition

setBuggy, isBuggy

Methods

buggy :: a -> a Source #

setBuggy :: Bool -> a -> a Source #

isBuggy :: a -> Bool Source #

Instances
Buggy (Rule a) Source # 
Instance details

Defined in Ideas.Common.Rule.Abstract

Methods

buggy :: Rule a -> Rule a Source #

setBuggy :: Bool -> Rule a -> Rule a Source #

isBuggy :: Rule a -> Bool Source #

class BoolValue a => Boolean a where Source #

Minimal complete definition

(<&&>), (<||>), complement

Methods

(<&&>) :: a -> a -> a Source #

(<||>) :: a -> a -> a Source #

complement :: a -> a Source #

Instances
Boolean Bool Source # 
Instance details

Defined in Ideas.Common.Classes

Boolean (Predicate a) Source # 
Instance details

Defined in Ideas.Common.Predicate

Boolean b => Boolean (a -> b) Source # 
Instance details

Defined in Ideas.Common.Classes

Methods

(<&&>) :: (a -> b) -> (a -> b) -> a -> b Source #

(<||>) :: (a -> b) -> (a -> b) -> a -> b Source #

complement :: (a -> b) -> a -> b Source #

class BoolValue a where Source #

Minimal complete definition

isTrue, isFalse

Methods

true :: a Source #

false :: a Source #

fromBool :: Bool -> a Source #

isTrue :: a -> Bool Source #

isFalse :: a -> Bool Source #

Instances
BoolValue Bool Source # 
Instance details

Defined in Ideas.Common.Classes

BoolValue (Predicate a) Source # 
Instance details

Defined in Ideas.Common.Predicate

BoolValue b => BoolValue (a -> b) Source # 
Instance details

Defined in Ideas.Common.Classes

Methods

true :: a -> b Source #

false :: a -> b Source #

fromBool :: Bool -> a -> b Source #

isTrue :: (a -> b) -> Bool Source #

isFalse :: (a -> b) -> Bool Source #

class Fix a where Source #

Methods

fix :: (a -> a) -> a Source #

Instances
Fix (Process a) Source # 
Instance details

Defined in Ideas.Common.Strategy.Process

Methods

fix :: (Process a -> Process a) -> Process a Source #

Fix (Strategy a) Source # 
Instance details

Defined in Ideas.Common.Strategy.Abstract

Methods

fix :: (Strategy a -> Strategy a) -> Strategy a Source #

Fix (CyclicTree a b) Source # 
Instance details

Defined in Ideas.Common.Strategy.CyclicTree

Methods

fix :: (CyclicTree a b -> CyclicTree a b) -> CyclicTree a b Source #

class BiFunctor f where Source #

Minimal complete definition

biMap

Methods

biMap :: (a -> c) -> (b -> d) -> f a b -> f c d Source #

mapFirst :: (a -> b) -> f a c -> f b c Source #

mapSecond :: (b -> c) -> f a b -> f a c Source #

Instances
BiFunctor Either Source # 
Instance details

Defined in Ideas.Common.Classes

Methods

biMap :: (a -> c) -> (b -> d) -> Either a b -> Either c d Source #

mapFirst :: (a -> b) -> Either a c -> Either b c Source #

mapSecond :: (b -> c) -> Either a b -> Either a c Source #

BiFunctor (,) Source # 
Instance details

Defined in Ideas.Common.Classes

Methods

biMap :: (a -> c) -> (b -> d) -> (a, b) -> (c, d) Source #

mapFirst :: (a -> b) -> (a, c) -> (b, c) Source #

mapSecond :: (b -> c) -> (a, b) -> (a, c) Source #

BiFunctor CyclicTree Source # 
Instance details

Defined in Ideas.Common.Strategy.CyclicTree

Methods

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 # 
Instance details

Defined in Ideas.Common.Derivation

Methods

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 # 
Instance details

Defined in Ideas.Common.DerivationTree

Methods

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: -.

Minimal complete definition

(<->)

Methods

(<->) :: (a -> b) -> (b -> a) -> arr a b infix 1 Source #

(!->) :: (a -> b) -> arr a b Source #

(<-!) :: (b -> a) -> arr a b Source #

Instances
BiArrow Isomorphism Source # 
Instance details

Defined in Ideas.Common.View

Methods

(<->) :: (a -> b) -> (b -> a) -> Isomorphism a b Source #

(!->) :: (a -> b) -> Isomorphism a b Source #

(<-!) :: (b -> a) -> Isomorphism a b Source #

BiArrow View Source # 
Instance details

Defined in Ideas.Common.View

Methods

(<->) :: (a -> b) -> (b -> a) -> View a b Source #

(!->) :: (a -> b) -> View a b Source #

(<-!) :: (b -> a) -> View a b Source #

class Container f where Source #

Instances should satisfy the following law: getSingleton . singleton == Just

Minimal complete definition

singleton, getSingleton

Methods

singleton :: a -> f a Source #

getSingleton :: f a -> Maybe a Source #

Instances
Container [] Source # 
Instance details

Defined in Ideas.Common.Classes

Methods

singleton :: a -> [a] Source #

getSingleton :: [a] -> Maybe a Source #

Container Set Source # 
Instance details

Defined in Ideas.Common.Classes

Methods

singleton :: a -> Set a Source #

getSingleton :: Set a -> Maybe a Source #

class Apply t where Source #

A type class for functors that can be applied to a value. Transformation, Rule, and Strategy are all instances of this type class.

Minimal complete definition

applyAll

Methods

applyAll Source #

Arguments

:: t a 
-> a 
-> [a]

Returns zero or more results

Instances
Apply RewriteRule Source # 
Instance details

Defined in Ideas.Common.Rewriting.RewriteRule

Methods

applyAll :: RewriteRule a -> a -> [a] Source #

Apply Rule Source # 
Instance details

Defined in Ideas.Common.Rule.Abstract

Methods

applyAll :: Rule a -> a -> [a] Source #

Apply Dynamic Source # 
Instance details

Defined in Ideas.Common.Strategy.StrategyTree

Methods

applyAll :: Dynamic a -> a -> [a] Source #

Apply Leaf Source # 
Instance details

Defined in Ideas.Common.Strategy.StrategyTree

Methods

applyAll :: Leaf a -> a -> [a] Source #

Apply LabeledStrategy Source # 
Instance details

Defined in Ideas.Common.Strategy.Abstract

Methods

applyAll :: LabeledStrategy a -> a -> [a] Source #

Apply Strategy Source # 
Instance details

Defined in Ideas.Common.Strategy.Abstract

Methods

applyAll :: Strategy a -> a -> [a] Source #

Apply Exercise Source # 
Instance details

Defined in Ideas.Common.Exercise

Methods

applyAll :: Exercise a -> a -> [a] Source #

apply :: Apply t => t a -> a -> Maybe a Source #

Returns zero or one results

applicable :: Apply t => t a -> a -> Bool Source #

Checks whether the functor is applicable (at least one result)

applyD :: Apply t => t a -> a -> a Source #

If not applicable, return the current value (as default)

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

applyList :: Apply t => [t a] -> a -> Maybe a Source #

mapBoth :: BiFunctor f => (a -> b) -> f a a -> f b b Source #

ands :: Boolean a => [a] -> a Source #

ors :: Boolean a => [a] -> a Source #

implies :: Boolean a => a -> a -> a Source #

equivalent :: Boolean a => a -> a -> a Source #

data Some f Source #

Constructors

Some (f a) 

readM :: (Monad m, Read a) => String -> m a Source #

class HasId a where Source #

Type classfor accessing (and changing) the identifier of an entity.

Minimal complete definition

getId, changeId

Methods

getId :: a -> Id Source #

changeId :: (Id -> Id) -> a -> a Source #

Instances
HasId Id Source # 
Instance details

Defined in Ideas.Common.Id

Methods

getId :: Id -> Id Source #

changeId :: (Id -> Id) -> Id -> Id Source #

HasId ViewPackage Source # 
Instance details

Defined in Ideas.Common.View

HasId Symbol Source # 
Instance details

Defined in Ideas.Common.Rewriting.Term

Methods

getId :: Symbol -> Id Source #

changeId :: (Id -> Id) -> Symbol -> Symbol Source #

HasId Binding Source # 
Instance details

Defined in Ideas.Common.Environment

Methods

getId :: Binding -> Id Source #

changeId :: (Id -> Id) -> Binding -> Binding Source #

HasId Service Source # 
Instance details

Defined in Ideas.Service.Types

Methods

getId :: Service -> Id Source #

changeId :: (Id -> Id) -> Service -> Service Source #

HasId DomainReasoner Source # 
Instance details

Defined in Ideas.Service.DomainReasoner

HasId (Predicate a) Source # 
Instance details

Defined in Ideas.Common.Predicate

Methods

getId :: Predicate a -> Id Source #

changeId :: (Id -> Id) -> Predicate a -> Predicate a Source #

HasId (Constraint a) Source # 
Instance details

Defined in Ideas.Common.Constraint

Methods

getId :: Constraint a -> Id Source #

changeId :: (Id -> Id) -> Constraint a -> Constraint a Source #

HasId (Ref a) Source # 
Instance details

Defined in Ideas.Common.Environment

Methods

getId :: Ref a -> Id Source #

changeId :: (Id -> Id) -> Ref a -> Ref a Source #

HasId (RewriteRule a) Source # 
Instance details

Defined in Ideas.Common.Rewriting.RewriteRule

HasId (Rule a) Source # 
Instance details

Defined in Ideas.Common.Rule.Abstract

Methods

getId :: Rule a -> Id Source #

changeId :: (Id -> Id) -> Rule a -> Rule a Source #

HasId (Decl f) Source # 
Instance details

Defined in Ideas.Common.Strategy.StrategyTree

Methods

getId :: Decl f -> Id Source #

changeId :: (Id -> Id) -> Decl f -> Decl f Source #

HasId (Dynamic a) Source # 
Instance details

Defined in Ideas.Common.Strategy.StrategyTree

Methods

getId :: Dynamic a -> Id Source #

changeId :: (Id -> Id) -> Dynamic a -> Dynamic a Source #

HasId (Leaf a) Source # 
Instance details

Defined in Ideas.Common.Strategy.StrategyTree

Methods

getId :: Leaf a -> Id Source #

changeId :: (Id -> Id) -> Leaf a -> Leaf a Source #

HasId (LabeledStrategy a) Source # 
Instance details

Defined in Ideas.Common.Strategy.Abstract

HasId (Exercise a) Source # 
Instance details

Defined in Ideas.Common.Exercise

Methods

getId :: Exercise a -> Id Source #

changeId :: (Id -> Id) -> Exercise a -> Exercise a Source #

HasId (State a) Source # 
Instance details

Defined in Ideas.Service.State

Methods

getId :: State a -> Id Source #

changeId :: (Id -> Id) -> State a -> State a Source #

(HasId a, HasId b) => HasId (Either a b) Source # 
Instance details

Defined in Ideas.Common.Id

Methods

getId :: Either a b -> Id Source #

changeId :: (Id -> Id) -> Either a b -> Either a b Source #

HasId (Isomorphism a b) Source # 
Instance details

Defined in Ideas.Common.View

Methods

getId :: Isomorphism a b -> Id Source #

changeId :: (Id -> Id) -> Isomorphism a b -> Isomorphism a b Source #

HasId (View a b) Source # 
Instance details

Defined in Ideas.Common.View

Methods

getId :: View a b -> Id Source #

changeId :: (Id -> Id) -> View a b -> View a b Source #

class HasId a => Identify a where Source #

Type class for labeling entities with an identifier

Minimal complete definition

(@>)

Methods

(@>) :: IsId n => n -> a -> a Source #

Instances
Identify (Predicate a) Source # 
Instance details

Defined in Ideas.Common.Predicate

Methods

(@>) :: IsId n => n -> Predicate a -> Predicate a Source #

Identify (Isomorphism a b) Source # 
Instance details

Defined in Ideas.Common.View

Methods

(@>) :: IsId n => n -> Isomorphism a b -> Isomorphism a b Source #

Identify (View a b) Source # 
Instance details

Defined in Ideas.Common.View

Methods

(@>) :: IsId n => n -> View a b -> View a b Source #

class IsId a where Source #

Type class IsId for constructing identifiers. Examples are newId "algebra.equation", newId ("a", "b", "c"), and newId () for the empty identifier.

Minimal complete definition

newId

Methods

newId :: a -> Id Source #

concatId :: [a] -> Id Source #

Instances
IsId Char Source # 
Instance details

Defined in Ideas.Common.Id

Methods

newId :: Char -> Id Source #

concatId :: [Char] -> Id Source #

IsId () Source # 
Instance details

Defined in Ideas.Common.Id

Methods

newId :: () -> Id Source #

concatId :: [()] -> Id Source #

IsId Id Source # 
Instance details

Defined in Ideas.Common.Id

Methods

newId :: Id -> Id Source #

concatId :: [Id] -> Id Source #

IsId a => IsId [a] Source # 
Instance details

Defined in Ideas.Common.Id

Methods

newId :: [a] -> Id Source #

concatId :: [[a]] -> Id Source #

IsId a => IsId (Maybe a) Source # 
Instance details

Defined in Ideas.Common.Id

Methods

newId :: Maybe a -> Id Source #

concatId :: [Maybe a] -> Id Source #

(IsId a, IsId b) => IsId (Either a b) Source # 
Instance details

Defined in Ideas.Common.Id

Methods

newId :: Either a b -> Id Source #

concatId :: [Either a b] -> Id Source #

(IsId a, IsId b) => IsId (a, b) Source # 
Instance details

Defined in Ideas.Common.Id

Methods

newId :: (a, b) -> Id Source #

concatId :: [(a, b)] -> Id Source #

(IsId a, IsId b, IsId c) => IsId (a, b, c) Source # 
Instance details

Defined in Ideas.Common.Id

Methods

newId :: (a, b, c) -> Id Source #

concatId :: [(a, b, c)] -> Id Source #

data Id Source #

Abstract data type for identifiers with a hierarchical name, carrying a description. The data type provides a fast comparison implementation.

Instances
Eq Id Source # 
Instance details

Defined in Ideas.Common.Id

Methods

(==) :: Id -> Id -> Bool #

(/=) :: Id -> Id -> Bool #

Ord Id Source # 
Instance details

Defined in Ideas.Common.Id

Methods

compare :: Id -> Id -> Ordering #

(<) :: Id -> Id -> Bool #

(<=) :: Id -> Id -> Bool #

(>) :: Id -> Id -> Bool #

(>=) :: Id -> Id -> Bool #

max :: Id -> Id -> Id #

min :: Id -> Id -> Id #

Read Id Source # 
Instance details

Defined in Ideas.Common.Id

Show Id Source # 
Instance details

Defined in Ideas.Common.Id

Methods

showsPrec :: Int -> Id -> ShowS #

show :: Id -> String #

showList :: [Id] -> ShowS #

Semigroup Id Source # 
Instance details

Defined in Ideas.Common.Id

Methods

(<>) :: Id -> Id -> Id #

sconcat :: NonEmpty Id -> Id #

stimes :: Integral b => b -> Id -> Id #

Monoid Id Source # 
Instance details

Defined in Ideas.Common.Id

Methods

mempty :: Id #

mappend :: Id -> Id -> Id #

mconcat :: [Id] -> Id #

Arbitrary Id Source # 
Instance details

Defined in Ideas.Common.Id

Methods

arbitrary :: Gen Id

shrink :: Id -> [Id]

ToHTML Id Source # 
Instance details

Defined in Ideas.Common.Id

HasId Id Source # 
Instance details

Defined in Ideas.Common.Id

Methods

getId :: Id -> Id Source #

changeId :: (Id -> Id) -> Id -> Id Source #

IsId Id Source # 
Instance details

Defined in Ideas.Common.Id

Methods

newId :: Id -> Id Source #

concatId :: [Id] -> Id Source #

(#) :: (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.

showId :: HasId a => a -> String Source #

Show the identifier.

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 #

Constructors

ViewPackage :: (Show a, Show b, Eq a) => (String -> Maybe a) -> View a b -> ViewPackage 
Instances
HasId ViewPackage Source # 
Instance details

Defined in Ideas.Common.View

class LiftView f where Source #

Minimal complete definition

liftViewIn

Methods

liftView :: View a b -> f b -> f a Source #

liftViewIn :: View a (b, c) -> f b -> f a Source #

Instances
LiftView Constraint Source # 
Instance details

Defined in Ideas.Common.Constraint

Methods

liftView :: View a b -> Constraint b -> Constraint a Source #

liftViewIn :: View a (b, c) -> Constraint b -> Constraint a Source #

LiftView Recognizer Source # 
Instance details

Defined in Ideas.Common.Rule.Recognizer

Methods

liftView :: View a b -> Recognizer b -> Recognizer a Source #

liftViewIn :: View a (b, c) -> Recognizer b -> Recognizer a Source #

LiftView Rule Source # 
Instance details

Defined in Ideas.Common.Rule.Abstract

Methods

liftView :: View a b -> Rule b -> Rule a Source #

liftViewIn :: View a (b, c) -> Rule b -> Rule a Source #

LiftView Dynamic Source # 
Instance details

Defined in Ideas.Common.Strategy.StrategyTree

Methods

liftView :: View a b -> Dynamic b -> Dynamic a Source #

liftViewIn :: View a (b, c) -> Dynamic b -> Dynamic a Source #

LiftView Leaf Source # 
Instance details

Defined in Ideas.Common.Strategy.StrategyTree

Methods

liftView :: View a b -> Leaf b -> Leaf a Source #

liftViewIn :: View a (b, c) -> Leaf b -> Leaf a Source #

LiftView LabeledStrategy Source # 
Instance details

Defined in Ideas.Common.Strategy.Abstract

LiftView Strategy Source # 
Instance details

Defined in Ideas.Common.Strategy.Abstract

Methods

liftView :: View a b -> Strategy b -> Strategy a Source #

liftViewIn :: View a (b, c) -> Strategy b -> Strategy a Source #

data Isomorphism a b Source #

Instances
Arrow Isomorphism Source # 
Instance details

Defined in Ideas.Common.View

Methods

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') #

ArrowChoice Isomorphism Source # 
Instance details

Defined in Ideas.Common.View

Methods

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 #

BiArrow Isomorphism Source # 
Instance details

Defined in Ideas.Common.View

Methods

(<->) :: (a -> b) -> (b -> a) -> Isomorphism a b Source #

(!->) :: (a -> b) -> Isomorphism a b Source #

(<-!) :: (b -> a) -> Isomorphism a b Source #

IsView Isomorphism Source # 
Instance details

Defined in Ideas.Common.View

Methods

build :: Isomorphism a b -> b -> a Source #

toView :: Isomorphism a b -> View a b Source #

IsMatcher Isomorphism Source # 
Instance details

Defined in Ideas.Common.View

Methods

match :: Isomorphism a b -> a -> Maybe b Source #

matcher :: Isomorphism a b -> Matcher a b Source #

Category Isomorphism Source # 
Instance details

Defined in Ideas.Common.View

Methods

id :: Isomorphism a a #

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

HasId (Isomorphism a b) Source # 
Instance details

Defined in Ideas.Common.View

Methods

getId :: Isomorphism a b -> Id Source #

changeId :: (Id -> Id) -> Isomorphism a b -> Isomorphism a b Source #

Identify (Isomorphism a b) Source # 
Instance details

Defined in Ideas.Common.View

Methods

(@>) :: IsId n => n -> Isomorphism a b -> Isomorphism a b Source #

data View a b Source #

Instances
Arrow View Source # 
Instance details

Defined in Ideas.Common.View

Methods

arr :: (b -> c) -> View b c #

first :: View b c -> View (b, d) (c, d) #

second :: View b c -> View (d, b) (d, c) #

(***) :: View b c -> View b' c' -> View (b, b') (c, c') #

(&&&) :: View b c -> View b c' -> View b (c, c') #

ArrowChoice View Source # 
Instance details

Defined in Ideas.Common.View

Methods

left :: View b c -> View (Either b d) (Either c d) #

right :: View b c -> View (Either d b) (Either d c) #

(+++) :: View b c -> View b' c' -> View (Either b b') (Either c c') #

(|||) :: View b d -> View c d -> View (Either b c) d #

BiArrow View Source # 
Instance details

Defined in Ideas.Common.View

Methods

(<->) :: (a -> b) -> (b -> a) -> View a b Source #

(!->) :: (a -> b) -> View a b Source #

(<-!) :: (b -> a) -> View a b Source #

IsView View Source # 
Instance details

Defined in Ideas.Common.View

Methods

build :: View a b -> b -> a Source #

toView :: View a b -> View a b Source #

IsMatcher View Source # 
Instance details

Defined in Ideas.Common.View

Methods

match :: View a b -> a -> Maybe b Source #

matcher :: View a b -> Matcher a b Source #

Category View Source # 
Instance details

Defined in Ideas.Common.View

Methods

id :: View a a #

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

HasId (View a b) Source # 
Instance details

Defined in Ideas.Common.View

Methods

getId :: View a b -> Id Source #

changeId :: (Id -> Id) -> View a b -> View a b Source #

Identify (View a b) Source # 
Instance details

Defined in Ideas.Common.View

Methods

(@>) :: IsId n => n -> View a b -> View a b Source #

class IsMatcher f => IsView f where Source #

Minimal complete definition: toView or both match and build.

Methods

build :: f a b -> b -> a Source #

toView :: f a b -> View a b Source #

Instances
IsView Isomorphism Source # 
Instance details

Defined in Ideas.Common.View

Methods

build :: Isomorphism a b -> b -> a Source #

toView :: Isomorphism a b -> View a b Source #

IsView View Source # 
Instance details

Defined in Ideas.Common.View

Methods

build :: View a b -> b -> a Source #

toView :: View a b -> View a b Source #

data Matcher a b Source #

Instances
Arrow Matcher Source # 
Instance details

Defined in Ideas.Common.View

Methods

arr :: (b -> c) -> Matcher b c #

first :: Matcher b c -> Matcher (b, d) (c, d) #

second :: Matcher b c -> Matcher (d, b) (d, c) #

(***) :: Matcher b c -> Matcher b' c' -> Matcher (b, b') (c, c') #

(&&&) :: Matcher b c -> Matcher b c' -> Matcher b (c, c') #

ArrowZero Matcher Source # 
Instance details

Defined in Ideas.Common.View

Methods

zeroArrow :: Matcher b c #

ArrowPlus Matcher Source # 
Instance details

Defined in Ideas.Common.View

Methods

(<+>) :: Matcher b c -> Matcher b c -> Matcher b c #

ArrowChoice Matcher Source # 
Instance details

Defined in Ideas.Common.View

Methods

left :: Matcher b c -> Matcher (Either b d) (Either c d) #

right :: Matcher b c -> Matcher (Either d b) (Either d c) #

(+++) :: Matcher b c -> Matcher b' c' -> Matcher (Either b b') (Either c c') #

(|||) :: Matcher b d -> Matcher c d -> Matcher (Either b c) d #

IsMatcher Matcher Source # 
Instance details

Defined in Ideas.Common.View

Methods

match :: Matcher a b -> a -> Maybe b Source #

matcher :: Matcher a b -> Matcher a b Source #

Category Matcher Source # 
Instance details

Defined in Ideas.Common.View

Methods

id :: Matcher a a #

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

class IsMatcher f where Source #

Methods

match :: f a b -> a -> Maybe b Source #

matcher :: f a b -> Matcher a b Source #

Instances
IsMatcher Isomorphism Source # 
Instance details

Defined in Ideas.Common.View

Methods

match :: Isomorphism a b -> a -> Maybe b Source #

matcher :: Isomorphism a b -> Matcher a b Source #

IsMatcher View Source # 
Instance details

Defined in Ideas.Common.View

Methods

match :: View a b -> a -> Maybe b Source #

matcher :: View a b -> Matcher a b Source #

IsMatcher Matcher Source # 
Instance details

Defined in Ideas.Common.View

Methods

match :: Matcher a b -> a -> Maybe b Source #

matcher :: Matcher a b -> Matcher a b Source #

matchM :: (Monad m, IsMatcher f) => f a b -> a -> m b Source #

generalized monadic variant of match

belongsTo :: IsMatcher f => a -> f a b -> Bool Source #

viewEquivalent :: (IsMatcher f, Eq b) => f a b -> a -> a -> Bool Source #

viewEquivalentWith :: IsMatcher f => (b -> b -> Bool) -> f a b -> a -> a -> Bool Source #

makeMatcher :: (a -> Maybe b) -> Matcher a b Source #

canonical :: IsView f => f a b -> a -> Maybe a Source #

canonicalWith :: IsView f => (b -> b) -> f a b -> a -> Maybe a Source #

canonicalWithM :: IsView f => (b -> Maybe b) -> f a b -> a -> Maybe a Source #

isCanonical :: (IsView f, Eq a) => f a b -> a -> Bool Source #

isCanonicalWith :: IsView f => (a -> a -> Bool) -> f a b -> a -> Bool Source #

simplify :: IsView f => f a b -> a -> 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 #

makeView :: (a -> Maybe b) -> (b -> a) -> View a b Source #

matcherView :: Matcher a b -> (b -> a) -> View a b Source #

identity :: Category f => f a a Source #

swapView :: Isomorphism (a, b) (b, a) Source #

listView :: View a b -> View [a] [b] Source #

Specialized version of traverseView

traverseView :: Traversable f => View a b -> View (f a) (f b) Source #

($<) :: Traversable f => View a (f b) -> View b c -> View a (f c) Source #

propIdempotence :: (Show a, Eq a) => Gen a -> View a b -> Property Source #

propSoundness :: Show a => (a -> a -> Bool) -> Gen a -> View a c -> Property Source #

propNormalForm :: (Show a, Eq a) => Gen a -> View a b -> Property Source #

data Predicate a Source #

Instances
Boolean (Predicate a) Source # 
Instance details

Defined in Ideas.Common.Predicate

BoolValue (Predicate a) Source # 
Instance details

Defined in Ideas.Common.Predicate

HasId (Predicate a) Source # 
Instance details

Defined in Ideas.Common.Predicate

Methods

getId :: Predicate a -> Id Source #

changeId :: (Id -> Id) -> Predicate a -> Predicate a Source #

Identify (Predicate a) Source # 
Instance details

Defined in Ideas.Common.Predicate

Methods

(@>) :: IsId n => n -> Predicate a -> Predicate a Source #

data Difficulty Source #

data Examples a Source #

Instances
Functor Examples Source # 
Instance details

Defined in Ideas.Common.Examples

Methods

fmap :: (a -> b) -> Examples a -> Examples b #

(<$) :: a -> Examples b -> Examples a #

Semigroup (Examples a) Source # 
Instance details

Defined in Ideas.Common.Examples

Methods

(<>) :: Examples a -> Examples a -> Examples a #

sconcat :: NonEmpty (Examples a) -> Examples a #

stimes :: Integral b => b -> Examples a -> Examples a #

Monoid (Examples a) Source # 
Instance details

Defined in Ideas.Common.Examples

Methods

mempty :: Examples a #

mappend :: Examples a -> Examples a -> Examples a #

mconcat :: [Examples a] -> Examples a #

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
LiftView Constraint Source # 
Instance details

Defined in Ideas.Common.Constraint

Methods

liftView :: View a b -> Constraint b -> Constraint a Source #

liftViewIn :: View a (b, c) -> Constraint b -> Constraint a Source #

Eq (Constraint a) Source # 
Instance details

Defined in Ideas.Common.Constraint

Methods

(==) :: Constraint a -> Constraint a -> Bool #

(/=) :: Constraint a -> Constraint a -> Bool #

Ord (Constraint a) Source # 
Instance details

Defined in Ideas.Common.Constraint

Show (Constraint a) Source # 
Instance details

Defined in Ideas.Common.Constraint

HasId (Constraint a) Source # 
Instance details

Defined in Ideas.Common.Constraint

Methods

getId :: Constraint a -> Id Source #

changeId :: (Id -> Id) -> Constraint a -> Constraint a Source #

makeConstraint :: IsId n => n -> (a -> Result ()) -> Constraint a Source #

isSatisfied :: Constraint a -> a -> Bool Source #

Satisfaction condition

isViolated :: Constraint a -> a -> Maybe String Source #

Satisfaction condition

relevance :: Result a -> Result a Source #

Turn errors into irrelevant results

castFrom :: (HasTypeable f, Typeable b) => f a -> a -> Maybe b Source #

castTo :: (HasTypeable f, Typeable a) => f b -> a -> Maybe b Source #

top :: Navigator a => a -> a Source #

arity :: Navigator a => a -> Int Source #

class WithMetaVars a where Source #

Minimal complete definition

metaVar, getMetaVar

Methods

metaVar :: Int -> a Source #

getMetaVar :: Monad m => a -> m Int Source #

Instances
WithMetaVars Term Source # 
Instance details

Defined in Ideas.Common.Rewriting.Term

Methods

metaVar :: Int -> Term Source #

getMetaVar :: Monad m => Term -> m Int Source #

class WithVars a where Source #

Minimal complete definition

variable, getVariable

Methods

variable :: String -> a Source #

getVariable :: Monad m => a -> m String Source #

Instances
WithVars Term Source # 
Instance details

Defined in Ideas.Common.Rewriting.Term

class WithFunctions a where Source #

Minimal complete definition

function, getFunction

Methods

symbol :: Symbol -> a Source #

function :: Symbol -> [a] -> a Source #

getSymbol :: Monad m => a -> m Symbol Source #

getFunction :: Monad m => a -> m (Symbol, [a]) Source #

Instances
WithFunctions Term Source # 
Instance details

Defined in Ideas.Common.Rewriting.Term

class IsTerm a where Source #

Minimal complete definition

toTerm, fromTerm

Methods

toTerm :: a -> Term Source #

toTermList :: [a] -> Term Source #

fromTerm :: MonadPlus m => Term -> m a Source #

fromTermList :: MonadPlus m => Term -> m [a] Source #

Instances
IsTerm Bool Source # 
Instance details

Defined in Ideas.Common.Rewriting.Term

IsTerm Char Source # 
Instance details

Defined in Ideas.Common.Rewriting.Term

IsTerm Double Source # 
Instance details

Defined in Ideas.Common.Rewriting.Term

IsTerm Int Source # 
Instance details

Defined in Ideas.Common.Rewriting.Term

IsTerm Integer Source # 
Instance details

Defined in Ideas.Common.Rewriting.Term

IsTerm ShowString Source # 
Instance details

Defined in Ideas.Common.Rewriting.Term

IsTerm Term Source # 
Instance details

Defined in Ideas.Common.Rewriting.Term

IsTerm a => IsTerm [a] Source # 
Instance details

Defined in Ideas.Common.Rewriting.Term

Methods

toTerm :: [a] -> Term Source #

toTermList :: [[a]] -> Term Source #

fromTerm :: MonadPlus m => Term -> m [a] Source #

fromTermList :: MonadPlus m => Term -> m [[a]] Source #

IsTerm a => IsTerm (Maybe a) Source # 
Instance details

Defined in Ideas.Common.Rewriting.Term

(IsTerm a, Ord a) => IsTerm (Set a) Source # 
Instance details

Defined in Ideas.Common.Rewriting.Term

Methods

toTerm :: Set a -> Term Source #

toTermList :: [Set a] -> Term Source #

fromTerm :: MonadPlus m => Term -> m (Set a) Source #

fromTermList :: MonadPlus m => Term -> m [Set a] Source #

(IsTerm a, IsTerm b) => IsTerm (Either a b) Source # 
Instance details

Defined in Ideas.Common.Rewriting.Term

Methods

toTerm :: Either a b -> Term Source #

toTermList :: [Either a b] -> Term Source #

fromTerm :: MonadPlus m => Term -> m (Either a b) Source #

fromTermList :: MonadPlus m => Term -> m [Either a b] Source #

(IsTerm a, IsTerm b) => IsTerm (a, b) Source # 
Instance details

Defined in Ideas.Common.Rewriting.Term

Methods

toTerm :: (a, b) -> Term Source #

toTermList :: [(a, b)] -> Term Source #

fromTerm :: MonadPlus m => Term -> m (a, b) Source #

fromTermList :: MonadPlus m => Term -> m [(a, b)] Source #

(IsTerm a, IsTerm b, Ord a) => IsTerm (Map a b) Source # 
Instance details

Defined in Ideas.Common.Rewriting.Term

Methods

toTerm :: Map a b -> Term Source #

toTermList :: [Map a b] -> Term Source #

fromTerm :: MonadPlus m => Term -> m (Map a b) Source #

fromTermList :: MonadPlus m => Term -> m [Map a b] Source #

(IsTerm s, IsTerm a) => IsTerm (Derivation s a) Source # 
Instance details

Defined in Ideas.Common.Derivation

(IsTerm a, IsTerm b, IsTerm c) => IsTerm (a, b, c) Source # 
Instance details

Defined in Ideas.Common.Rewriting.Term

Methods

toTerm :: (a, b, c) -> Term Source #

toTermList :: [(a, b, c)] -> Term Source #

fromTerm :: MonadPlus m => Term -> m (a, b, c) Source #

fromTermList :: MonadPlus m => Term -> m [(a, b, c)] Source #

data Term Source #

Instances
Eq Term Source # 
Instance details

Defined in Ideas.Common.Rewriting.Term

Methods

(==) :: Term -> Term -> Bool #

(/=) :: Term -> Term -> Bool #

Ord Term Source # 
Instance details

Defined in Ideas.Common.Rewriting.Term

Methods

compare :: Term -> Term -> Ordering #

(<) :: Term -> Term -> Bool #

(<=) :: Term -> Term -> Bool #

(>) :: Term -> Term -> Bool #

(>=) :: Term -> Term -> Bool #

max :: Term -> Term -> Term #

min :: Term -> Term -> Term #

Read Term Source # 
Instance details

Defined in Ideas.Common.Rewriting.Term

Show Term Source # 
Instance details

Defined in Ideas.Common.Rewriting.Term

Methods

showsPrec :: Int -> Term -> ShowS #

show :: Term -> String #

showList :: [Term] -> ShowS #

Arbitrary Term Source # 
Instance details

Defined in Ideas.Common.Rewriting.Term

Methods

arbitrary :: Gen Term

shrink :: Term -> [Term]

Uniplate Term Source # 
Instance details

Defined in Ideas.Common.Rewriting.Term

Methods

uniplate :: Term -> (Str Term, Str Term -> Term) #

descend :: (Term -> Term) -> Term -> Term #

descendM :: Monad m => (Term -> m Term) -> Term -> m Term #

WithMetaVars Term Source # 
Instance details

Defined in Ideas.Common.Rewriting.Term

Methods

metaVar :: Int -> Term Source #

getMetaVar :: Monad m => Term -> m Int Source #

WithVars Term Source # 
Instance details

Defined in Ideas.Common.Rewriting.Term

WithFunctions Term Source # 
Instance details

Defined in Ideas.Common.Rewriting.Term

IsTerm Term Source # 
Instance details

Defined in Ideas.Common.Rewriting.Term

Reference Term Source # 
Instance details

Defined in Ideas.Common.Environment

Methods

makeRef :: IsId n => n -> Ref Term Source #

makeRefList :: IsId n => n -> Ref [Term] Source #

Different Term Source # 
Instance details

Defined in Ideas.Common.Rewriting.RewriteRule

Methods

different :: (Term, Term) Source #

data Symbol Source #

Instances
Eq Symbol Source # 
Instance details

Defined in Ideas.Common.Rewriting.Term

Methods

(==) :: Symbol -> Symbol -> Bool #

(/=) :: Symbol -> Symbol -> Bool #

Ord Symbol Source # 
Instance details

Defined in Ideas.Common.Rewriting.Term

Read Symbol Source # 
Instance details

Defined in Ideas.Common.Rewriting.Term

Show Symbol Source # 
Instance details

Defined in Ideas.Common.Rewriting.Term

HasId Symbol Source # 
Instance details

Defined in Ideas.Common.Rewriting.Term

Methods

getId :: Symbol -> Id Source #

changeId :: (Id -> Id) -> Symbol -> Symbol Source #

fromTermM :: (Monad m, IsTerm a) => Term -> m a Source #

fromTermWith :: (Monad m, IsTerm a) => (Symbol -> [a] -> m a) -> Term -> m a 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 #

isUnary :: (WithFunctions a, Monad m) => Symbol -> a -> m a Source #

isBinary :: (WithFunctions a, Monad m) => Symbol -> a -> m (a, a) Source #

vars :: (Uniplate a, WithVars a) => a -> [String] Source #

hasVar :: (Uniplate a, WithVars a) => String -> a -> Bool Source #

toTermG :: Data a => a -> Term Source #

fromTermG :: (MonadPlus m, Data a) => Term -> m a Source #

class HasRefs a where Source #

Minimal complete definition

allRefs

Methods

getRefs :: a -> [Some Ref] Source #

allRefs :: a -> [Some Ref] Source #

getRefIds :: a -> [Id] Source #

Instances
HasRefs Environment Source # 
Instance details

Defined in Ideas.Common.Environment

HasRefs (Recognizer a) Source # 
Instance details

Defined in Ideas.Common.Rule.Recognizer

HasRefs (Rule a) Source # 
Instance details

Defined in Ideas.Common.Rule.Abstract

Methods

getRefs :: Rule a -> [Some Ref] Source #

allRefs :: Rule a -> [Some Ref] Source #

getRefIds :: Rule a -> [Id] Source #

HasRefs (Trans a b) Source # 
Instance details

Defined in Ideas.Common.Rule.Transformation

Methods

getRefs :: Trans a b -> [Some Ref] Source #

allRefs :: Trans a b -> [Some Ref] Source #

getRefIds :: Trans a b -> [Id] Source #

class HasEnvironment env where Source #

Minimal complete definition

environment, setEnvironment

Methods

environment :: env -> Environment Source #

setEnvironment :: Environment -> env -> env Source #

deleteRef :: Ref a -> env -> env Source #

insertRef :: Ref a -> a -> env -> env Source #

changeRef :: Ref a -> (a -> a) -> env -> env Source #

data Binding Source #

Instances
Eq Binding Source # 
Instance details

Defined in Ideas.Common.Environment

Methods

(==) :: Binding -> Binding -> Bool #

(/=) :: Binding -> Binding -> Bool #

Show Binding Source # 
Instance details

Defined in Ideas.Common.Environment

HasId Binding Source # 
Instance details

Defined in Ideas.Common.Environment

Methods

getId :: Binding -> Id Source #

changeId :: (Id -> Id) -> Binding -> Binding Source #

class (IsTerm a, Typeable a, Show a, Read a) => Reference a where Source #

A type class for types as references

Methods

makeRef :: IsId n => n -> Ref a Source #

makeRefList :: IsId n => n -> Ref [a] Source #

Instances
Reference Char Source # 
Instance details

Defined in Ideas.Common.Environment

Methods

makeRef :: IsId n => n -> Ref Char Source #

makeRefList :: IsId n => n -> Ref [Char] Source #

Reference Int Source # 
Instance details

Defined in Ideas.Common.Environment

Methods

makeRef :: IsId n => n -> Ref Int Source #

makeRefList :: IsId n => n -> Ref [Int] Source #

Reference ShowString Source # 
Instance details

Defined in Ideas.Common.Environment

Methods

makeRef :: IsId n => n -> Ref ShowString Source #

makeRefList :: IsId n => n -> Ref [ShowString] Source #

Reference Term Source # 
Instance details

Defined in Ideas.Common.Environment

Methods

makeRef :: IsId n => n -> Ref Term Source #

makeRefList :: IsId n => n -> Ref [Term] Source #

Reference a => Reference [a] Source # 
Instance details

Defined in Ideas.Common.Environment

Methods

makeRef :: IsId n => n -> Ref [a] Source #

makeRefList :: IsId n => n -> Ref [[a]] Source #

(Reference a, Reference b) => Reference (a, b) Source # 
Instance details

Defined in Ideas.Common.Environment

Methods

makeRef :: IsId n => n -> Ref (a, b) Source #

makeRefList :: IsId n => n -> Ref [(a, b)] Source #

data Ref a Source #

A data type for references (without a value)

Instances
HasTypeable Ref Source # 
Instance details

Defined in Ideas.Common.Environment

Methods

getTypeable :: Ref a -> Maybe (IsTypeable a) Source #

Eq (Ref a) Source # 
Instance details

Defined in Ideas.Common.Environment

Methods

(==) :: Ref a -> Ref a -> Bool #

(/=) :: Ref a -> Ref a -> Bool #

Show (Ref a) Source # 
Instance details

Defined in Ideas.Common.Environment

Methods

showsPrec :: Int -> Ref a -> ShowS #

show :: Ref a -> String #

showList :: [Ref a] -> ShowS #

HasId (Ref a) Source # 
Instance details

Defined in Ideas.Common.Environment

Methods

getId :: Ref a -> Id Source #

changeId :: (Id -> Id) -> Ref a -> Ref a Source #

mapRef :: Typeable b => Isomorphism a b -> Ref a -> Ref b Source #

(?) :: HasEnvironment env => Ref a -> env -> Maybe a Source #

class (IsTerm a, Show a) => RuleBuilder t a | t -> a where Source #

Minimal complete definition

buildRuleSpec

Instances
(IsTerm a, Show a) => RuleBuilder (RuleSpec a) a Source # 
Instance details

Defined in Ideas.Common.Rewriting.RewriteRule

(Different a, RuleBuilder t b) => RuleBuilder (a -> t) b Source # 
Instance details

Defined in Ideas.Common.Rewriting.RewriteRule

Methods

buildRuleSpec :: Int -> (a -> t) -> RuleSpec Term Source #

class Different a where Source #

Minimal complete definition

different

Methods

different :: (a, a) Source #

Instances
Different Bool Source # 
Instance details

Defined in Ideas.Common.Rewriting.RewriteRule

Methods

different :: (Bool, Bool) Source #

Different Char Source # 
Instance details

Defined in Ideas.Common.Rewriting.RewriteRule

Methods

different :: (Char, Char) Source #

Different Double Source # 
Instance details

Defined in Ideas.Common.Rewriting.RewriteRule

Different Float Source # 
Instance details

Defined in Ideas.Common.Rewriting.RewriteRule

Different Int Source # 
Instance details

Defined in Ideas.Common.Rewriting.RewriteRule

Methods

different :: (Int, Int) Source #

Different Integer Source # 
Instance details

Defined in Ideas.Common.Rewriting.RewriteRule

Different Rational Source # 
Instance details

Defined in Ideas.Common.Rewriting.RewriteRule

Different Term Source # 
Instance details

Defined in Ideas.Common.Rewriting.RewriteRule

Methods

different :: (Term, Term) Source #

Different a => Different [a] Source # 
Instance details

Defined in Ideas.Common.Rewriting.RewriteRule

Methods

different :: ([a], [a]) Source #

(Different a, Different b) => Different (a, b) Source # 
Instance details

Defined in Ideas.Common.Rewriting.RewriteRule

Methods

different :: ((a, b), (a, b)) Source #

(Different a, Different b, Different c) => Different (a, b, c) Source # 
Instance details

Defined in Ideas.Common.Rewriting.RewriteRule

Methods

different :: ((a, b, c), (a, b, c)) Source #

data RuleSpec a Source #

Constructors

a :~> a infixl 1 
Instances
Functor RuleSpec Source # 
Instance details

Defined in Ideas.Common.Rewriting.RewriteRule

Methods

fmap :: (a -> b) -> RuleSpec a -> RuleSpec b #

(<$) :: a -> RuleSpec b -> RuleSpec a #

Show a => Show (RuleSpec a) Source # 
Instance details

Defined in Ideas.Common.Rewriting.RewriteRule

Methods

showsPrec :: Int -> RuleSpec a -> ShowS #

show :: RuleSpec a -> String #

showList :: [RuleSpec a] -> ShowS #

(IsTerm a, Show a) => RuleBuilder (RuleSpec a) a Source # 
Instance details

Defined in Ideas.Common.Rewriting.RewriteRule

makeRewriteRule :: (IsId n, RuleBuilder f a) => n -> f -> RewriteRule a Source #

data Derivation s a Source #

Instances
BiFunctor Derivation Source # 
Instance details

Defined in Ideas.Common.Derivation

Methods

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 #

Functor (Derivation s) Source # 
Instance details

Defined in Ideas.Common.Derivation

Methods

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

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

(Eq a, Eq s) => Eq (Derivation s a) Source # 
Instance details

Defined in Ideas.Common.Derivation

Methods

(==) :: Derivation s a -> Derivation s a -> Bool #

(/=) :: Derivation s a -> Derivation s a -> Bool #

(Show s, Show a) => Show (Derivation s a) Source # 
Instance details

Defined in Ideas.Common.Derivation

Methods

showsPrec :: Int -> Derivation s a -> ShowS #

show :: Derivation s a -> String #

showList :: [Derivation s a] -> ShowS #

(IsTerm s, IsTerm a) => IsTerm (Derivation s a) Source # 
Instance details

Defined in Ideas.Common.Derivation

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.

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 Context a Source #

Abstract data type for a context: a context stores an environment.

Instances
Eq a => Eq (Context a) Source # 
Instance details

Defined in Ideas.Common.Context

Methods

(==) :: Context a -> Context a -> Bool #

(/=) :: Context a -> Context a -> Bool #

Show a => Show (Context a) Source # 
Instance details

Defined in Ideas.Common.Context

Methods

showsPrec :: Int -> Context a -> ShowS #

show :: Context a -> String #

showList :: [Context a] -> ShowS #

Navigator (Context a) Source # 
Instance details

Defined in Ideas.Common.Context

HasEnvironment (Context a) Source # 
Instance details

Defined in Ideas.Common.Context

fromContext :: Monad m => Context a -> m a Source #

fromContextWith :: Monad m => (a -> b) -> Context a -> m b Source #

fromContextWith2 :: Monad m => (a -> b -> c) -> Context a -> Context b -> m c Source #

newContext :: ContextNavigator a -> Context a Source #

Construct a context

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

use :: (LiftView f, IsTerm a, IsTerm b) => f a -> f (Context b) Source #

useC :: (LiftView f, IsTerm a, IsTerm b) => f (Context a) -> f (Context b) Source #

changeInContext :: (a -> 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.

Minimal complete definition

makeTrans

Methods

makeTrans :: (a -> f b) -> Trans a b Source #

Instances
MakeTrans [] Source # 
Instance details

Defined in Ideas.Common.Rule.Transformation

Methods

makeTrans :: (a -> [b]) -> Trans a b Source #

MakeTrans Maybe Source # 
Instance details

Defined in Ideas.Common.Rule.Transformation

Methods

makeTrans :: (a -> Maybe b) -> Trans a b Source #

data Trans a b Source #

Instances
Arrow Trans Source # 
Instance details

Defined in Ideas.Common.Rule.Transformation

Methods

arr :: (b -> c) -> Trans b c #

first :: Trans b c -> Trans (b, d) (c, d) #

second :: Trans b c -> Trans (d, b) (d, c) #

(***) :: Trans b c -> Trans b' c' -> Trans (b, b') (c, c') #

(&&&) :: Trans b c -> Trans b c' -> Trans b (c, c') #

ArrowZero Trans Source # 
Instance details

Defined in Ideas.Common.Rule.Transformation

Methods

zeroArrow :: Trans b c #

ArrowPlus Trans Source # 
Instance details

Defined in Ideas.Common.Rule.Transformation

Methods

(<+>) :: Trans b c -> Trans b c -> Trans b c #

ArrowChoice Trans Source # 
Instance details

Defined in Ideas.Common.Rule.Transformation

Methods

left :: Trans b c -> Trans (Either b d) (Either c d) #

right :: Trans b c -> Trans (Either d b) (Either d c) #

(+++) :: Trans b c -> Trans b' c' -> Trans (Either b b') (Either c c') #

(|||) :: Trans b d -> Trans c d -> Trans (Either b c) d #

Functor (Trans a) Source # 
Instance details

Defined in Ideas.Common.Rule.Transformation

Methods

fmap :: (a0 -> b) -> Trans a a0 -> Trans a b #

(<$) :: a0 -> Trans a b -> Trans a a0 #

Applicative (Trans a) Source # 
Instance details

Defined in Ideas.Common.Rule.Transformation

Methods

pure :: a0 -> Trans a a0 #

(<*>) :: Trans a (a0 -> b) -> Trans a a0 -> Trans a b #

liftA2 :: (a0 -> b -> c) -> Trans a a0 -> Trans a b -> Trans a c #

(*>) :: Trans a a0 -> Trans a b -> Trans a b #

(<*) :: Trans a a0 -> Trans a b -> Trans a a0 #

Alternative (Trans a) Source # 
Instance details

Defined in Ideas.Common.Rule.Transformation

Methods

empty :: Trans a a0 #

(<|>) :: Trans a a0 -> Trans a a0 -> Trans a a0 #

some :: Trans a a0 -> Trans a [a0] #

many :: Trans a a0 -> Trans a [a0] #

Category Trans Source # 
Instance details

Defined in Ideas.Common.Rule.Transformation

Methods

id :: Trans a a #

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

Semigroup (Trans a b) Source # 
Instance details

Defined in Ideas.Common.Rule.Transformation

Methods

(<>) :: Trans a b -> Trans a b -> Trans a b #

sconcat :: NonEmpty (Trans a b) -> Trans a b #

stimes :: Integral b0 => b0 -> Trans a b -> Trans a b #

Monoid (Trans a b) Source # 
Instance details

Defined in Ideas.Common.Rule.Transformation

Methods

mempty :: Trans a b #

mappend :: Trans a b -> Trans a b -> Trans a b #

mconcat :: [Trans a b] -> Trans a b #

HasRefs (Trans a b) Source # 
Instance details

Defined in Ideas.Common.Rule.Transformation

Methods

getRefs :: Trans a b -> [Some Ref] Source #

allRefs :: Trans a b -> [Some Ref] Source #

getRefIds :: Trans a b -> [Id] Source #

transPure :: (a -> b) -> Trans a b Source #

transMaybe :: (a -> Maybe b) -> Trans a b Source #

transList :: (a -> [b]) -> Trans a b Source #

transGuard :: (a -> Bool) -> Trans a a Source #

readRef :: Ref a -> Trans x a Source #

readRefDefault :: a -> Ref a -> Trans x a Source #

writeRef :: Ref a -> Trans a a Source #

writeRef_ :: Ref a -> Trans a () Source #

transApply :: Trans a b -> a -> [(b, Environment)] Source #

class Recognizable f where Source #

Minimal complete definition

recognizer

Methods

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 #

makeRecognizer :: (a -> a -> Bool) -> Recognizer a Source #

data Rule a Source #

Abstract data type for representing rules

Instances
Apply Rule Source # 
Instance details

Defined in Ideas.Common.Rule.Abstract

Methods

applyAll :: Rule a -> a -> [a] Source #

LiftView Rule Source # 
Instance details

Defined in Ideas.Common.Rule.Abstract

Methods

liftView :: View a b -> Rule b -> Rule a Source #

liftViewIn :: View a (b, c) -> Rule b -> Rule a Source #

Recognizable Rule Source # 
Instance details

Defined in Ideas.Common.Rule.Abstract

Methods

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 # 
Instance details

Defined in Ideas.Common.Strategy.Abstract

Methods

toStrategy :: Rule a -> Strategy a Source #

Eq (Rule a) Source # 
Instance details

Defined in Ideas.Common.Rule.Abstract

Methods

(==) :: Rule a -> Rule a -> Bool #

(/=) :: Rule a -> Rule a -> Bool #

Ord (Rule a) Source # 
Instance details

Defined in Ideas.Common.Rule.Abstract

Methods

compare :: Rule a -> Rule a -> Ordering #

(<) :: Rule a -> Rule a -> Bool #

(<=) :: Rule a -> Rule a -> Bool #

(>) :: Rule a -> Rule a -> Bool #

(>=) :: Rule a -> Rule a -> Bool #

max :: Rule a -> Rule a -> Rule a #

min :: Rule a -> Rule a -> Rule a #

Show (Rule a) Source # 
Instance details

Defined in Ideas.Common.Rule.Abstract

Methods

showsPrec :: Int -> Rule a -> ShowS #

show :: Rule a -> String #

showList :: [Rule a] -> ShowS #

Minor (Rule a) Source # 
Instance details

Defined in Ideas.Common.Rule.Abstract

Methods

minor :: Rule a -> Rule a Source #

setMinor :: Bool -> Rule a -> Rule a Source #

isMinor :: Rule a -> Bool Source #

isMajor :: Rule a -> Bool Source #

Buggy (Rule a) Source # 
Instance details

Defined in Ideas.Common.Rule.Abstract

Methods

buggy :: Rule a -> Rule a Source #

setBuggy :: Bool -> Rule a -> Rule a Source #

isBuggy :: Rule a -> Bool Source #

HasId (Rule a) Source # 
Instance details

Defined in Ideas.Common.Rule.Abstract

Methods

getId :: Rule a -> Id Source #

changeId :: (Id -> Id) -> Rule a -> Rule a Source #

HasRefs (Rule a) Source # 
Instance details

Defined in Ideas.Common.Rule.Abstract

Methods

getRefs :: Rule a -> [Some Ref] Source #

allRefs :: Rule a -> [Some Ref] Source #

getRefIds :: Rule a -> [Id] Source #

LabelSymbol (Rule a) Source # 
Instance details

Defined in Ideas.Common.Strategy.Symbol

Methods

isEnterSymbol :: Rule a -> Bool Source #

AtomicSymbol (Rule a) Source # 
Instance details

Defined in Ideas.Common.Strategy.Symbol

makeRule :: (IsId n, MakeTrans f) => n -> (a -> f a) -> Rule a Source #

ruleMaybe :: IsId n => n -> (a -> Maybe a) -> Rule a Source #

ruleList :: IsId n => n -> (a -> [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 #

buggyRule :: (IsId n, MakeTrans f) => n -> (a -> f a) -> Rule a Source #

minorRule :: (IsId n, MakeTrans f) => n -> (a -> f a) -> Rule a Source #

emptyRule :: IsId n => n -> Rule a Source #

A special (minor) rule that is never applicable (i.e., this rule always fails)

idRule :: IsId n => n -> Rule a Source #

A special (minor) rule that always returns the identity

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)

siblingOf :: HasId b => b -> Rule a -> Rule a Source #

doAfter :: (a -> a) -> Rule a -> Rule a Source #

Perform the function after the rule has been fired

addRecognizerBool :: (a -> a -> Bool) -> Rule a -> Rule a Source #

addTransRecognizer :: (a -> a -> Bool) -> Rule a -> Rule a Source #

type ParamTrans i a = Trans (i, a) a Source #

input :: Ref i -> Trans (i, a) b -> Trans a b Source #

inputWith :: Trans a i -> Trans (i, a) b -> Trans a b Source #

transInput1 :: Ref i -> (i -> a -> Maybe b) -> Trans a b Source #

transInput2 :: Ref i1 -> Ref i2 -> (i1 -> i2 -> a -> Maybe b) -> Trans a b Source #

transInput3 :: Ref i1 -> Ref i2 -> Ref i3 -> (i1 -> i2 -> i3 -> a -> Maybe b) -> Trans a b Source #

transInputWith :: MakeTrans f => Trans a i -> (i -> a -> f b) -> Trans a b Source #

readRef2 :: Ref a -> Ref b -> Trans x (a, b) Source #

readRef3 :: Ref a -> Ref b -> Ref c -> Trans x (a, b, c) Source #

output :: Ref o -> Trans a (b, o) -> Trans a b Source #

outputWith :: Trans o x -> Trans a (b, o) -> Trans a b Source #

outputOnly :: Ref o -> Trans a o -> Trans a a Source #

outputOnly2 :: Ref o1 -> Ref o2 -> Trans a (o1, o2) -> Trans a a Source #

outputOnly3 :: Ref o1 -> Ref o2 -> Ref o3 -> Trans a (o1, o2, o3) -> Trans a a Source #

outputOnlyWith :: Trans o x -> Trans a o -> Trans a a Source #

writeRef2 :: Ref a -> Ref b -> Trans (a, b) (a, b) Source #

writeRef2_ :: Ref a -> Ref b -> Trans (a, b) () Source #

writeRef3 :: Ref a -> Ref b -> Ref c -> Trans (a, b, c) (a, b, c) Source #

writeRef3_ :: Ref a -> Ref b -> Ref c -> Trans (a, b, c) () 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 #

transRef :: Ref a -> Trans a a Source #

data Path 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).

Instances
Eq Path Source # 
Instance details

Defined in Ideas.Common.Strategy.Prefix

Methods

(==) :: Path -> Path -> Bool #

(/=) :: Path -> Path -> Bool #

Show Path Source # 
Instance details

Defined in Ideas.Common.Strategy.Prefix

Methods

showsPrec :: Int -> Path -> ShowS #

show :: Path -> String #

showList :: [Path] -> ShowS #

data Prefix a Source #

Instances
Show (Prefix a) Source # 
Instance details

Defined in Ideas.Common.Strategy.Prefix

Methods

showsPrec :: Int -> Prefix a -> ShowS #

show :: Prefix a -> String #

showList :: [Prefix a] -> ShowS #

Semigroup (Prefix a) Source # 
Instance details

Defined in Ideas.Common.Strategy.Prefix

Methods

(<>) :: Prefix a -> Prefix a -> Prefix a #

sconcat :: NonEmpty (Prefix a) -> Prefix a #

stimes :: Integral b => b -> Prefix a -> Prefix a #

Monoid (Prefix a) Source # 
Instance details

Defined in Ideas.Common.Strategy.Prefix

Methods

mempty :: Prefix a #

mappend :: Prefix a -> Prefix a -> Prefix a #

mconcat :: [Prefix a] -> Prefix a #

Firsts (Prefix a) Source # 
Instance details

Defined in Ideas.Common.Strategy.Prefix

Associated Types

type Elem (Prefix a) :: * Source #

Methods

ready :: Prefix a -> Bool Source #

firsts :: Prefix a -> [(Elem (Prefix a), Prefix a)] Source #

type Elem (Prefix a) Source # 
Instance details

Defined in Ideas.Common.Strategy.Prefix

type Elem (Prefix a) = (Rule a, a, Environment)

noPrefix :: Prefix a Source #

The error prefix (i.e., without a location in the strategy).

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.

emptyPath :: Path Source #

The empty path.

data LabeledStrategy a Source #

A strategy which is labeled with an identifier

class IsStrategy f where Source #

Type class to turn values into strategies

Minimal complete definition

toStrategy

Methods

toStrategy :: f a -> Strategy a Source #

data Strategy a Source #

Abstract data type for strategies

Instances
Apply Strategy Source # 
Instance details

Defined in Ideas.Common.Strategy.Abstract

Methods

applyAll :: Strategy a -> a -> [a] Source #

LiftView Strategy Source # 
Instance details

Defined in Ideas.Common.Strategy.Abstract

Methods

liftView :: View a b -> Strategy b -> Strategy a Source #

liftViewIn :: View a (b, c) -> Strategy b -> Strategy a Source #

IsStrategy Strategy Source # 
Instance details

Defined in Ideas.Common.Strategy.Abstract

Show (Strategy a) Source # 
Instance details

Defined in Ideas.Common.Strategy.Abstract

Methods

showsPrec :: Int -> Strategy a -> ShowS #

show :: Strategy a -> String #

showList :: [Strategy a] -> ShowS #

Fix (Strategy a) Source # 
Instance details

Defined in Ideas.Common.Strategy.Abstract

Methods

fix :: (Strategy a -> Strategy a) -> Strategy a Source #

Choice (Strategy a) Source # 
Instance details

Defined in Ideas.Common.Strategy.Abstract

Sequence (Strategy a) Source # 
Instance details

Defined in Ideas.Common.Strategy.Abstract

Associated Types

type Sym (Strategy a) :: * Source #

type Sym (Strategy a) Source # 
Instance details

Defined in Ideas.Common.Strategy.Abstract

type Sym (Strategy a) = Rule a

label :: (IsId l, IsStrategy f) => l -> f a -> LabeledStrategy a Source #

Labels a strategy with an identifier. Labels are used to identify substrategies and to specialize feedback messages. The first argument of label can be of type String, in which case the string is used as identifier (and not as description).

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

strategyLocations :: LabeledStrategy a -> [([Int], Id)] Source #

Returns a list of all strategy locations, paired with the label

remove :: 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)

succeed :: Strategy a Source #

The strategy that always succeeds (without doing anything)

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

data Option a Source #

Instances
Semigroup (Option a) Source # 
Instance details

Defined in Ideas.Common.Strategy.Traversal

Methods

(<>) :: Option a -> Option a -> Option a #

sconcat :: NonEmpty (Option a) -> Option a #

stimes :: Integral b => b -> Option a -> Option a #

Monoid (Option a) Source # 
Instance details

Defined in Ideas.Common.Strategy.Traversal

Methods

mempty :: Option a #

mappend :: Option a -> Option a -> Option a #

mconcat :: [Option a] -> Option a #

layer :: (IsStrategy f, Navigator a) => [Option a] -> f a -> Strategy a Source #

traverse :: (IsStrategy f, Navigator a) => [Option a] -> f a -> Strategy a Source #

parentFilter :: Navigator a => (a -> [Int]) -> Option a Source #

fulltd :: (IsStrategy f, Navigator a) => f a -> Strategy a Source #

fullbu :: (IsStrategy f, Navigator a) => f a -> Strategy a Source #

oncetd :: (IsStrategy f, Navigator a) => f a -> Strategy a Source #

oncebu :: (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.

data Status Source #

The status of an exercise class.

Constructors

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

Instances
Eq Status Source # 
Instance details

Defined in Ideas.Common.Exercise

Methods

(==) :: Status -> Status -> Bool #

(/=) :: Status -> Status -> Bool #

Show Status Source # 
Instance details

Defined in Ideas.Common.Exercise

data Exercise a Source #

For constructing an empty exercise, use function emptyExercise or makeExercise.

Constructors

NewExercise 

Fields

  • exerciseId :: Id

    Identifier that uniquely determines the exercise: see HasId for how to use values with identifiers.

  • status :: Status

    The status of the exercise.

  • parser :: String -> Either String a

    Parser for expressions of the exercise class, which either results in an error (Left) or a result (Right).

  • prettyPrinter :: a -> String

    Pretty-printer for expressions of the exercise class. Pretty-printing should be the inverse of parsing.

  • equivalence :: Context a -> Context a -> Bool

    Tests wether two expressions (with their contexts) are semantically equivalent. Use withoutContext for defining the equivalence check when the context is not relevant.

  • similarity :: Context a -> Context a -> Bool

    Tests wether two expressions (with their contexts) are syntactically the same, or nearly so. Expressions that are similar must also be equivalent. Use withoutContext if the context is not relevant for the similarity check.

  • suitable :: Predicate a

    Predicate suitable identifies which expressions can be solved by the strategy of the exercise class. It acts as the pre-condition of the strategy.

  • ready :: Predicate a

    Predicate ready checks if an expression is in a solved form (accepted as a final solution). It acts as the post-condition of the strategy.

  • strategy :: LabeledStrategy (Context a)

    The rewrite strategy that specifies how to solve an exercise.

  • canBeRestarted :: Bool

    Is it possible to restart the rewrite strategy at any point in time? Restarting the strategy is needed when a student deviates from the strategy (detour). By default, restarting is assumed to be possible.

  • extraRules :: [Rule (Context a)]

    Are there extra rules, possibly buggy, that do not appear in the strategy? Use ruleset to get all rules.

  • ruleOrdering :: Rule (Context a) -> Rule (Context a) -> Ordering

    The rule ordering is a tiebreaker in situations where more than one rule can be used (e.g. feedback services onefirst and derivation; other feedback services return all possible rules).

  • constraints :: [Constraint (Context a)]

    Constraints for constraint-based tutors. A constraint contains a relevance condition and a satisfaction condition.

  • navigation :: a -> ContextNavigator a

    A navigator is needed for traversing the expression and for using the traversal strategy combinators. By default, an exercise has no navigator.

  • examples :: Examples a

    A finite list of examples, each with an assigned difficulty.

  • hasTermView :: Maybe (View Term a)

    Conversion to and from the (generic) Term datatype. Needed for representing the expression in the OpenMath standard.

  • hasTypeable :: Maybe (IsTypeable a)

    Representation of the type of expression: this provides a back door for exercise-specific functionality.

  • properties :: Map Id (Dynamic a)

    Extra exercise-specific properties, not used by the default feedback services.

Instances
Apply Exercise Source # 
Instance details

Defined in Ideas.Common.Exercise

Methods

applyAll :: Exercise a -> a -> [a] Source #

HasTypeable Exercise Source # 
Instance details

Defined in Ideas.Common.Exercise

Eq (Exercise a) Source # 
Instance details

Defined in Ideas.Common.Exercise

Methods

(==) :: Exercise a -> Exercise a -> Bool #

(/=) :: Exercise a -> Exercise a -> Bool #

Ord (Exercise a) Source # 
Instance details

Defined in Ideas.Common.Exercise

Methods

compare :: Exercise a -> Exercise a -> Ordering #

(<) :: Exercise a -> Exercise a -> Bool #

(<=) :: Exercise a -> Exercise a -> Bool #

(>) :: Exercise a -> Exercise a -> Bool #

(>=) :: Exercise a -> Exercise a -> Bool #

max :: Exercise a -> Exercise a -> Exercise a #

min :: Exercise a -> Exercise a -> Exercise a #

HasId (Exercise a) Source # 
Instance details

Defined in Ideas.Common.Exercise

Methods

getId :: Exercise a -> Id Source #

changeId :: (Id -> Id) -> Exercise a -> 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.

isReady :: Exercise a -> a -> Bool Source #

Checks if an expression is in a solved form.

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

isPublic :: Exercise a -> Bool Source #

An exercise with the status Stable or Provisional

isPrivate :: Exercise a -> Bool Source #

An exercise that is not public

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

Returns the examples of an exercise class lifted to a context.

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.

failS :: Strategy a Source #

Alias for strategy combinator fail

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

untilS :: IsStrategy f => (a -> Bool) -> f a -> Strategy a Source #

Alias for strategy combinator until

data Some f Source #

Constructors

Some (f a)