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

Control.Unification.Ranked.STVar

Description

A ranked variant of Control.Unification.STVar.

Synopsis

Documentation

data STRVar s t Source #

A ranked unification variable implemented by STRefs. In addition to the STRef for the term itself, we also track the variable's ID (to support visited-sets) and rank (to support weighted path compression).

Instances

Instances details
Unifiable t => RankedBindingMonad t (STRVar s t) (STRBinding s) Source # 
Instance details

Defined in Control.Unification.Ranked.STVar

Unifiable t => BindingMonad t (STRVar s t) (STRBinding s) Source # 
Instance details

Defined in Control.Unification.Ranked.STVar

Methods

lookupVar :: STRVar s t -> STRBinding s (Maybe (UTerm t (STRVar s t))) Source #

freeVar :: STRBinding s (STRVar s t) Source #

newVar :: UTerm t (STRVar s t) -> STRBinding s (STRVar s t) Source #

bindVar :: STRVar s t -> UTerm t (STRVar s t) -> STRBinding s () Source #

Eq (STRVar s t) Source # 
Instance details

Defined in Control.Unification.Ranked.STVar

Methods

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

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

Show (STRVar s t) Source # 
Instance details

Defined in Control.Unification.Ranked.STVar

Methods

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

show :: STRVar s t -> String #

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

Variable (STRVar s t) Source # 
Instance details

Defined in Control.Unification.Ranked.STVar

Methods

getVarID :: STRVar s t -> Int Source #

data STRBinding s a Source #

A monad for handling STRVar bindings.

Instances

Instances details
Unifiable t => RankedBindingMonad t (STRVar s t) (STRBinding s) Source # 
Instance details

Defined in Control.Unification.Ranked.STVar

Unifiable t => BindingMonad t (STRVar s t) (STRBinding s) Source # 
Instance details

Defined in Control.Unification.Ranked.STVar

Methods

lookupVar :: STRVar s t -> STRBinding s (Maybe (UTerm t (STRVar s t))) Source #

freeVar :: STRBinding s (STRVar s t) Source #

newVar :: UTerm t (STRVar s t) -> STRBinding s (STRVar s t) Source #

bindVar :: STRVar s t -> UTerm t (STRVar s t) -> STRBinding s () Source #

Monad (STRBinding s) Source # 
Instance details

Defined in Control.Unification.Ranked.STVar

Methods

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

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

return :: a -> STRBinding s a #

Functor (STRBinding s) Source # 
Instance details

Defined in Control.Unification.Ranked.STVar

Methods

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

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

Applicative (STRBinding s) Source # 
Instance details

Defined in Control.Unification.Ranked.STVar

Methods

pure :: a -> STRBinding s a #

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

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

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

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

runSTRBinding :: (forall s. STRBinding s a) -> a Source #

Run the ST ranked binding monad. N.B., because STRVar 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.