simple-reflect-0.3.3: Simple reflection of expressions containing variables

Copyright(c) 2008-2014 Twan van Laarhoven
LicenseBSD-style
Maintainertwanvl@gmail.com
Stabilityexperimental
Portabilityportable
Safe HaskellSafe
LanguageHaskell98

Debug.SimpleReflect.Expr

Contents

Description

Simple reflection of haskell expressions containing variables.

Synopsis

Construction

data Expr Source #

A reflected expression

Instances
Bounded Expr Source # 
Instance details

Defined in Debug.SimpleReflect.Expr

Enum Expr Source # 
Instance details

Defined in Debug.SimpleReflect.Expr

Eq Expr Source # 
Instance details

Defined in Debug.SimpleReflect.Expr

Methods

(==) :: Expr -> Expr -> Bool Source #

(/=) :: Expr -> Expr -> Bool Source #

Floating Expr Source # 
Instance details

Defined in Debug.SimpleReflect.Expr

Fractional Expr Source # 
Instance details

Defined in Debug.SimpleReflect.Expr

Integral Expr Source # 
Instance details

Defined in Debug.SimpleReflect.Expr

Num Expr Source # 
Instance details

Defined in Debug.SimpleReflect.Expr

Ord Expr Source # 
Instance details

Defined in Debug.SimpleReflect.Expr

Real Expr Source # 
Instance details

Defined in Debug.SimpleReflect.Expr

Show Expr Source # 
Instance details

Defined in Debug.SimpleReflect.Expr

Semigroup Expr Source # 
Instance details

Defined in Debug.SimpleReflect.Expr

Monoid Expr Source # 
Instance details

Defined in Debug.SimpleReflect.Expr

FromExpr Expr Source # 
Instance details

Defined in Debug.SimpleReflect.Expr

Methods

fromExpr :: Expr -> Expr Source #

class FromExpr a where Source #

Conversion from Expr to other types

Methods

fromExpr :: Expr -> a Source #

Instances
FromExpr Expr Source # 
Instance details

Defined in Debug.SimpleReflect.Expr

Methods

fromExpr :: Expr -> Expr Source #

(Show a, FromExpr b) => FromExpr (a -> b) Source # 
Instance details

Defined in Debug.SimpleReflect.Expr

Methods

fromExpr :: Expr -> a -> b Source #

var :: String -> Expr Source #

A variable with the given name

fun :: FromExpr a => String -> a Source #

A generic, overloaded, function variable

data Associativity Source #

This data type specifies the associativity of operators: left, right or none.

Constructors

InfixL 
Infix 
InfixR 

op :: Associativity -> Int -> String -> Expr -> Expr -> Expr Source #

An infix operator with the given associativity, precedence and name

Evaluating

expr :: Expr -> Expr Source #

Force something to be an expression.

reduce :: Expr -> Expr Source #

Reduce (evaluate) an expression once.

For example reduce (1 + 2 + 3 + 4) == 3 + 3 + 4

reduction :: Expr -> [Expr] Source #

Show all reduction steps when evaluating an expression.