algebra-dag-0.1.1.1: Infrastructure for DAG-shaped relational algebra plans

Safe HaskellNone
LanguageHaskell98

Database.Algebra.Rewrite.Match

Description

Pattern matches on algebra plans.

Synopsis

Documentation

newtype Match o p e a Source

The Match monad models the failing of a match and provides limited read-only access to the DAG.

Constructors

M (MaybeT (Reader (Env o p e)) a) 

Instances

runMatch :: e -> AlgebraDag o -> NodeMap p -> Match o p e a -> Maybe a Source

Runs a match on the supplied DAG. If the Match fails, Nothing is returned. If the Match succeeds, it returns just the result.

getParents :: AlgNode -> Match o p e [AlgNode] Source

Returns the parents of a node in a Match context.

predicate :: Bool -> Match o p e () Source

Fails the complete match if the predicate is False.

try :: Maybe a -> Match o p e a Source

Fails the complete match if the value is Nothing

matchOp :: Operator o => AlgNode -> (o -> Match o p e a) -> Match o p e a Source

Runs the supplied Match action on the operator that belongs to the given node.

properties :: AlgNode -> Match o p e p Source

Look up the properties for a given node.