hobbits-1.2.2: A library for canonically representing terms with binding

Copyright(c) 2014 Edwin Westbrook, Nicolas Frisby, and Paul Brauner
LicenseBSD3
Maintaineremw4@rice.edu
Stabilityexperimental
PortabilityGHC
Safe HaskellNone
LanguageHaskell98

Data.Binding.Hobbits.Closed

Contents

Description

This module uses Template Haskell to distinguish closed terms, so that the library can trust such functions to not contain any Name values in their closure.

Synopsis

Abstract types

data Cl a Source

The type Cl a represents a closed term of type a, i.e., an expression of type a with no free (Haskell) variables. Since this cannot be checked directly in the Haskell type system, the Cl data type is hidden, and the user can only create closed terms using Template Haskell, through the cl operator.

Operators involving Cl

cl :: Q Exp -> Q Exp Source

cl is used with Template Haskell quotations to create closed terms of type Cl. A quoted expression is closed if all of the names occuring in it are

1) bound globally or 2) bound within the quotation or 3) also of type Cl.

clApply :: Cl (a -> b) -> Cl a -> Cl b Source

Closed terms are closed (sorry) under application.

unCl :: Cl a -> a Source

noClosedNames :: Cl (Name a) -> b Source

noClosedNames encodes the hobbits guarantee that no name can escape its multi-binding.

Synonyms

mkClosed :: Q Exp -> Q Exp Source

mkClosed = cl

type Closed = Cl Source

Closed = Cl

unClosed :: Cl a -> a Source

unClosed = unCl