Lambda-Calculus
LicenseApache License 2.0
Stabilityexperimental
Safe HaskellSafe-Inferred
LanguageHaskell2010

Lambda.Lambda

Description

Attempts to simplify lambda expressions.

Synopsis

Documentation

data Expr t #

A lambda expression, which can either consist of a lambda, a term, or an application.

Constructors

Lambda (Expr t) 
App (Expr t) (Expr t) 
Term t 

Instances

Instances details
Eq t => Eq (Expr t) # 
Instance details

Defined in Lambda.Lambda

Methods

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

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

Show t => Show (Expr t) # 
Instance details

Defined in Lambda.Lambda

Methods

showsPrec :: Int -> Expr t -> ShowS #

show :: Expr t -> String #

showList :: [Expr t] -> ShowS #

termReplacer #

Arguments

:: Integral a 
=> (a -> t -> Expr s)

A function that takes, the term depth and term in ordr, and generates an expression.

-> a

The initial depth to use (used as a recursive parameter in code).

-> Expr t

The initial expression.

-> Expr s

The converted expression.

Replaces the terms in a lamdba expression, using a given function and initial depth.

reduce #

Arguments

:: Integral t 
=> t

The lamba depth of inner simplifications being done, which dictates which term should be replaced.

-> t

How many applications to reduce whilst doing an inner simplification: negative numbers remove the limit.

-> Expr t

The initial expression.

-> Expr t

The simplified expression.

Simplifies a lambda expression, using two counters, meaning that inner expresions are only evaluated if outer expressions can't be evaluated.