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

Copyright (c) 2014 Edwin Westbrook Nicolas Frisby and Paul Brauner BSD3 emw4@rice.edu experimental GHC None Haskell98

Data.Binding.Hobbits.Closed

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 Closed a Source #

The type Closed 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 Closed data type is hidden, and the user can only create closed terms using Template Haskell, through the mkClosed operator.

Instances

 Source # Methods Source # MethodsmbLift :: Mb ctx (Closed a) -> Closed a Source #

# Operators involving Closed

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

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

noClosedNames :: Closed (Name a) -> b Source #

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

clApply :: Closed (a -> b) -> Closed a -> Closed b Source #

Closed terms are closed (sorry) under application.

clMbApply :: Closed (Mb ctx (a -> b)) -> Closed (Mb ctx a) -> Closed (Mb ctx b) Source #

Closed multi-bindings are also closed under application.

clApplyCl :: Closed (Closed a -> b) -> Closed a -> Closed b Source #

When applying a closed function, the argument can be viewed as locally closed

# Typeclass for inherently closed types

class Closable a where Source #

Typeclass for inherently closed types

Minimal complete definition

toClosed

Methods

toClosed :: a -> Closed a Source #