lambdaBase-0.0.2.0

Safe HaskellSafe-Inferred
LanguageHaskell2010

Language.LambdaBase.Core

Description

 

Synopsis

Documentation

data EVS Source

Evaluation scheme, Lazy or Strict

Constructors

Lazy 
Strict 

Instances

data Arg Source

Lambda argument

Constructors

Arg !String !EVS 

Instances

data Fix Source

Infix Prefix LateInfix

The LateInfix is a trick used is the eval function.

Constructors

Infix 
Prefix 
LateInfix 

Instances

data NameType Source

A name is a 'to be' literal In a programme, foo can be a name ( if it is not a lambda argument ). "foo" is also a name but is delimited by double quotes.

Constructors

Naked 
Delimited String String 

Instances

data Expr a Source

An expression of host language a.

Constructors

Lambda !Arg !(Expr a) !Fix 
Expr ![Expr a] !Fix 
Name !String !NameType !Fix 
Lit !a !Fix 

Instances

Show a => Show (Expr a)

Crappy show instance ;(

class Lit a where Source

The Lit class is for the language contained inside lambdaBase.

toLit sould take a Name and transform it to a literal of its language.

apply is for function application.

A programme

add 123 321

will be evaluated by transforming add to a literal.

Transforming 123 to a literal.

Partially apply add and 123 with the apply function.

Transforming 321 to a literal.

Apply the "add123" literal and the 321 literal.

And if the Lit instance is correct, the result should be a 444 literal.

See lambdaLit for an example of a Lit instance.

Methods

apply :: a -> a -> Expr a Source

fromExpr :: Expr a -> a Source

toLit :: Expr a -> Maybe a Source

getEVS :: a -> EVS Source