Module FlatCurryMatch

Some useful operations to support selection of FlatCurry expressions via deep pattern matching.

Summary of exported operations:

withExp :: Expr -> Expr   
Returns (non-deterministically) some expression that contains the given expression as a subexpression.
funWithExp :: (String,String) -> Expr -> FuncDecl   
Returns (non-deterministically) a function declaration containing the given expression in the right-hand side.
inExp :: Expr -> Expr -> Expr -> Expr   
withElem :: a -> a -> [a] -> [a]   
Returns a list containing the first argument as an element.
funWithinExp :: (String,String) -> Expr -> Expr -> Expr -> FuncDecl   
Returns (non-deterministically) some function declaration for the given function name where the right-hand side is the given expression with a variable hole and a subexression.

Exported operations:

withExp :: Expr -> Expr   

Returns (non-deterministically) some expression that contains the given expression as a subexpression.

Further infos:
  • solution complete, i.e., able to compute all solutions

funWithExp :: (String,String) -> Expr -> FuncDecl   

Returns (non-deterministically) a function declaration containing the given expression in the right-hand side.

Further infos:
  • solution complete, i.e., able to compute all solutions

inExp :: Expr -> Expr -> Expr -> Expr   

withElem :: a -> a -> [a] -> [a]   

Returns a list containing the first argument as an element. Furthermore, the third argument is the result list except for the element which is replaced by the second argument. Hence, if withElem e x os evaluates to x1:...:xm:e:ys, where os=x1:...:xm:x:ys. Note that this construction is necessary to achieve a finite search space when matching against a finite expression with the operation inExp.

Further infos:
  • solution complete, i.e., able to compute all solutions

funWithinExp :: (String,String) -> Expr -> Expr -> Expr -> FuncDecl   

Returns (non-deterministically) some function declaration for the given function name where the right-hand side is the given expression with a variable hole and a subexression.

Example call:
(funWithinExp qf e x se)
Parameters:
  • qf : The qualified function name
  • e : The right-hand side with a hole containing x
  • x : The variable in the hole
  • se : The subexpression at the hole in the right-hand side
Returns:
The function declaration with e as the right-hand side