compdata-0.3: Compositional Data Types

Portabilitynon-portable (GHC Extensions)
Stabilityexperimental
MaintainerTom Hvitved <hvitved@diku.dk>

Data.Comp.MultiParam.FreshM

Description

This module defines a monad for generating fresh, abstract variables, useful e.g. for defining equality on terms.

Synopsis

Documentation

data FreshM a Source

Monad for generating fresh (abstract) variables.

Instances

data Var i Source

Abstract notion of a variable (the constructor is hidden).

Instances

PShow Var 
PEq Var 
POrd Var 
(ShowHD f, PShow a) => PShow (Cxt h f Var a)

From an ShowHD higher-order difunctor an ShowHD instance of the corresponding term type can be derived.

(EqHD f, PEq a) => PEq (Cxt h f Var a) 
(OrdHD f, POrd a) => POrd (Cxt h f Var a) 

varEq :: Var i -> Var j -> BoolSource

Equality on variables.

varCompare :: Var i -> Var j -> OrderingSource

Ordering of variables.

varShow :: Var i -> StringSource

Printing of variables.

genVar :: FreshM (Var i)Source

Generate a fresh variable.

varCoerce :: Var i -> Var jSource

Change the type of a variable.

evalFreshM :: FreshM a -> aSource

Evaluate a computation that uses fresh variables.