Module Unification

This module is undocumented. This is a list of its definitions.

createDefault :: Default a => <Proc> a

The default value of the type.

createUMap :: <Proc> UMap a b

Creates a new empty map.

extract :: Default a => Unifiable a -> <Proc> a

Like extractWithDefault, but uses the default value of the Default instance.

extractWithDefault :: <Proc> a -> Unifiable a -> <Proc> a

Extracts the value of the given unifiable value, evaluating deferred computations. Unification variables that are still unbound are bound to the value produced by the given default expression.

getUMap :: Default a => UMap b a -> b -> <Proc> a

Like getUMapWithDefault, but uses the default value of the Default instance.

getUMapWithDefault :: <Proc> a -> UMap b a -> b -> <Proc> a

getUMapWithDefault def m k extracts the value associated with the key k, using def for unification variables that remain unbound. If the map contains no such key, the value of def is associated with k and returned.

putUMap :: UMap a b -> a -> Unifiable b -> <Proc> ()

putUMap m k v associates v with the key k. If the map already associates a value with k, the two values are unified instead of being replaced.

putUMapC :: UMap a b -> a -> b -> <Proc> ()

Like putUMap, but takes an already known value.

uCons :: UTag a b -> b -> Unifiable a

uCons tag components creates a unifiable value built with the given constructor from the given components, which may themselves be unifiable.

uId :: a -> Unifiable a

An already known value as a unifiable value.

uPending :: <Proc> a -> Unifiable a

Creates a unifiable value whose computation is deferred until the value is needed. Unifications requested before that are checked against the value once it is computed. Fails if the computation depends on the value itself.

uTag :: Integer -> (a -> <Proc> b) -> (b -> a) -> UTag b a

uTag id constructor destructor creates a constructor tag with the given identifier, constructor and destructor.

uVar :: <Proc> Unifiable a

Creates a fresh unification variable, i.e. a completely unknown value.

unify :: Unifiable a -> Unifiable a -> <Proc> ()

Makes the two unifiable values equal, binding unification variables and recursively unifying the components of values built with the same constructor. Fails if the values are built with different constructors.