unbound-0.2: Generic support for programming with names and binders

MaintainerStephanie Weirich <sweirich@cis.upenn.edu>



A slow, but hopefully correct implementation of permutations.



data Perm a Source


Ord a => Eq (Perm a) 
Show a => Show (Perm a) 
Ord a => Monoid (Perm a) 

single :: Ord a => a -> a -> Perm aSource

compose :: Ord a => Perm a -> Perm a -> Perm aSource

Compose two permutations. The right-hand permutation will be applied first.

apply :: Ord a => Perm a -> a -> aSource

support :: Ord a => Perm a -> [a]Source

isid :: Ord a => Perm a -> BoolSource

isid -- do all keys map to themselves?

join :: Ord a => Perm a -> Perm a -> Maybe (Perm a)Source

Join two permutation. Fail if the two permutations map the same name to two different variables.

restrict :: Ord a => Perm a -> [a] -> Perm aSource

mkPerm :: Ord a => [a] -> [a] -> Maybe (Perm a)Source

mkPerm l1 l2 creates a permutation that sends l1 to l2. Fail if there is no such permutation, either because the lists have different lengths or because they are inconsistent (which can only happen if l1 or l2 have repeated elements).