unification-fd-0.11.1: Simple generic unification algorithms.
CopyrightCopyright (c) 2007--2015 wren gayle romano
LicenseBSD
Maintainerwren@community.haskell.org
Stabilityexperimental
Portabilitysemi-portable (Rank2Types, MPTCs,...)
Safe HaskellNone
LanguageHaskell98

Control.Unification.STVar

Description

This module defines an implementation of unification variables using the ST monad.

Synopsis

Documentation

data STVar s t Source #

Unification variables implemented by STRefs. In addition to the STRef for the term itself, we also track the variable's ID (to support visited-sets).

Instances

Instances details
Unifiable t => BindingMonad t (STVar s t) (STBinding s) Source # 
Instance details

Defined in Control.Unification.STVar

Methods

lookupVar :: STVar s t -> STBinding s (Maybe (UTerm t (STVar s t))) Source #

freeVar :: STBinding s (STVar s t) Source #

newVar :: UTerm t (STVar s t) -> STBinding s (STVar s t) Source #

bindVar :: STVar s t -> UTerm t (STVar s t) -> STBinding s () Source #

Eq (STVar s t) Source # 
Instance details

Defined in Control.Unification.STVar

Methods

(==) :: STVar s t -> STVar s t -> Bool #

(/=) :: STVar s t -> STVar s t -> Bool #

Show (STVar s t) Source # 
Instance details

Defined in Control.Unification.STVar

Methods

showsPrec :: Int -> STVar s t -> ShowS #

show :: STVar s t -> String #

showList :: [STVar s t] -> ShowS #

Variable (STVar s t) Source # 
Instance details

Defined in Control.Unification.STVar

Methods

getVarID :: STVar s t -> Int Source #

data STBinding s a Source #

A monad for handling STVar bindings.

Instances

Instances details
Unifiable t => BindingMonad t (STVar s t) (STBinding s) Source # 
Instance details

Defined in Control.Unification.STVar

Methods

lookupVar :: STVar s t -> STBinding s (Maybe (UTerm t (STVar s t))) Source #

freeVar :: STBinding s (STVar s t) Source #

newVar :: UTerm t (STVar s t) -> STBinding s (STVar s t) Source #

bindVar :: STVar s t -> UTerm t (STVar s t) -> STBinding s () Source #

Monad (STBinding s) Source # 
Instance details

Defined in Control.Unification.STVar

Methods

(>>=) :: STBinding s a -> (a -> STBinding s b) -> STBinding s b #

(>>) :: STBinding s a -> STBinding s b -> STBinding s b #

return :: a -> STBinding s a #

Functor (STBinding s) Source # 
Instance details

Defined in Control.Unification.STVar

Methods

fmap :: (a -> b) -> STBinding s a -> STBinding s b #

(<$) :: a -> STBinding s b -> STBinding s a #

Applicative (STBinding s) Source # 
Instance details

Defined in Control.Unification.STVar

Methods

pure :: a -> STBinding s a #

(<*>) :: STBinding s (a -> b) -> STBinding s a -> STBinding s b #

liftA2 :: (a -> b -> c) -> STBinding s a -> STBinding s b -> STBinding s c #

(*>) :: STBinding s a -> STBinding s b -> STBinding s b #

(<*) :: STBinding s a -> STBinding s b -> STBinding s a #

runSTBinding :: (forall s. STBinding s a) -> a Source #

Run the ST ranked binding monad. N.B., because STVar are rank-2 quantified, this guarantees that the return value has no such references. However, in order to remove the references from terms, you'll need to explicitly apply the bindings and ground the term.