liboleg-2010.1.6: An evolving collection of Oleg Kiselyov's Haskell modules

Language.TDPE

Contents

Description

Type-directed partial evaluation, Olivier Danvy, POPL96 * http://www.brics.dk/~danvy/tdpe-ln.pdf

Synopsis

Demo first

bbf1 and bbf2 are imported from the _compiled_ module ToTDPE

It would be great to have a function a -> repr a

Deriving reify_t :: t -> repr t

Why the name reify?

Start with reify_aa :: (a -> a) -> repr (a -> a)

Deriving reify_aabb :: (a->a)->(b->b) -> repr ((a->a)->(b->b))

We need reflect_aa :: repr (a->a) -> (repr a -> repr a)

We build reify_t and reflect_t together and inductively.

data RR repr meta obj Source

Constructors

RR 

Fields

reify :: meta -> repr obj
 
reflect :: repr obj -> meta
 

The base of induction (reify/reflect for base types)

base :: RR repr (repr a) aSource

The inductive case

(-->) :: Symantics repr => RR repr m1 o1 -> RR repr m2 o2 -> RR repr (m1 -> m2) (o1 -> o2)Source

Examples

Duality of reify/reflect

reflect . reify = eq_meta

reify . reflect = eq_obj

reify gives the object term representing the normal form of meta

cf Normalization-by-evaluation