liboleg-0.1.1: A collection of Oleg Kiselyov's Haskell modules (2009-2008)

Language.TEval.EvalTaglessF

Contents

Description

Tagless Typed lambda-calculus with integers and the conditional in the higher-order abstract syntax. Haskell itself ensures the object terms are well-typed. Here we use the tagless final approach.

http://okmij.org/ftp/Computation/Computation.html#teval

Synopsis

Documentation

class Symantics repr whereSource

Methods

l :: (repr t1 -> repr t2) -> repr (t1 -> t2)Source

a :: repr (t1 -> t2) -> repr t1 -> repr t2Source

i :: Int -> repr IntSource

(+:) :: repr Int -> repr Int -> repr IntSource

ifz :: repr Int -> repr t -> repr t -> repr tSource

fix :: repr ((a -> b) -> a -> b) -> repr (a -> b)Source

Instances

type VarCount = IntSource

Since we rely on the metalanguage for typechecking and hence type generalization, we have to use `let' of the metalanguage.

It is quite challenging to show terms. Yet, in contrast to the GADT-based approach (EvalTaglessI.hs), we are able to do that, without extending our language with auxiliary syntactic forms. Incidentally, showing of terms is just another way of _evaluating_ them, to strings.

newtype S t Source

Constructors

S (VarCount -> (String, VarCount)) 

Instances

newtype D t Source

We no longer need variables or the environment and we do normalization by evaluation.

Denotational semantics. Why?

Constructors

D t 

Instances

evald :: D t -> tSource

EvalTaglessF> :t term2