bimaps-0.1.0.2: bijections with multiple implementations.

Data.Bijection.Class

Synopsis

Documentation

data Bimap l r Source #

Bijection between finite sets.

Both data types are strict here.

Constructors

 Bimap !l !r

Instances

class DomCod z where Source #

Minimal complete definition

Associated Types

type Dom z :: * Source #

type Cod z :: * Source #

Methods

member :: z -> Dom z -> Bool Source #

lookup :: z -> Dom z -> Maybe (Cod z) Source #

deleteDC :: z -> Dom z -> Maybe (Cod z, z) Source #

insertDC :: z -> (Dom z, Cod z) -> z Source #

toListDC :: z -> [(Dom z, Cod z)] Source #

nullDC :: z -> Bool Source #

emptyDC :: z Source #

sizeDC :: z -> Int Source #

fromListDC :: [(Dom z, Cod z)] -> z Source #

type DomCodCnt l r = (DomCod l, DomCod r, Dom l ~ Cod r, Dom r ~ Cod l) Source #

contL :: Bimap l r -> l Source #

contR :: Bimap l r -> r Source #

memberL :: DomCod l => Bimap l r -> Dom l -> Bool Source #

memberR :: DomCod r => Bimap l r -> Dom r -> Bool Source #

lookupL :: DomCod l => Bimap l r -> Dom l -> Maybe (Cod l) Source #

lookupR :: DomCod r => Bimap l r -> Dom r -> Maybe (Cod r) Source #

empty :: DomCodCnt l r => Bimap l r Source #

null :: DomCod l => Bimap l r -> Bool Source #

size :: DomCod l => Bimap l r -> Int Source #

fromList :: DomCodCnt l r => [(Dom l, Dom r)] -> Bimap l r Source #

Given a list of pairs [(x,y)], turn it into a bimap (x->y, y->x).

toList :: DomCodCnt l r => Bimap l r -> [(Dom l, Dom r)] Source #

insert :: DomCodCnt l r => Bimap l r -> (Dom l, Cod l) -> Bimap l r Source #

deleteByL :: DomCodCnt l r => Bimap l r -> Dom l -> Bimap l r Source #

deleteByR :: DomCodCnt l r => Bimap l r -> Dom r -> Bimap l r Source #

findWithDefaultL :: DomCodCnt l r => Cod l -> Bimap l r -> Dom l -> Cod l Source #

findWithDefaultR :: DomCodCnt l r => Cod r -> Bimap l r -> Dom r -> Cod r Source #