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

PortabilityGHC
Stabilityexperimental
Maintaineremw4@rice.edu

Data.Binding.Hobbits.SuperComb

Contents

Description

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

Synopsis

Abstract types

data SuperComb a Source

The type SuperComb a represents a super-combinator 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 SuperComb data type is hidden, and the user can only create super-combinators using Template Haskell, through the superComb operator.

Operators involving SuperComb

superComb :: Q Exp -> Q ExpSource

superComb is used with Template Haskell to create super-combinators; see documentation for mbToplevel to see how it is used.

mbToplevel :: SuperComb (a -> b) -> Mb ctx a -> Mb ctx bSource

mbToplevel f b applies super-combinator f to the body of multi-binding b. For example:

 mbToplevel $(superComb [| f |]) (nu $ \n -> n)   =   nu f