set-algebra-0.1.0.0: Set Algebra
Safe Haskell None
Language Haskell2010

Control.Iterate.BaseTypes

Description

Defines what types can be used in the SetAlgebra, and what operations those types must support (Iter, Basic, Embed)

Synopsis

Documentation

class Iter f where Source #

Minimal complete definition

nxt , lub

Methods

nxt :: f a b -> Collect (a, b, f a b) Source #

lub :: Ord k => k -> f k b -> Collect (k, b, f k b) Source #

hasNxt :: f a b -> Maybe (a, b, f a b) Source #

hasLub :: Ord k => k -> f k b -> Maybe (k, b, f k b) Source #

haskey :: Ord key => key -> f key b -> Bool Source #

isnull :: f k v -> Bool Source #

lookup :: Ord key => key -> f key rng -> Maybe rng Source #

element :: Ord k => k -> f k v -> Collect () Source #

Instances

Instances details
Iter Map Source #
Instance details

Defined in Control.Iterate.BaseTypes

Iter Sett Source #
Instance details

Defined in Control.Iterate.BaseTypes

Iter Single Source #
Instance details

Defined in Control.Iterate.BaseTypes

Iter List Source #
Instance details

Defined in Control.Iterate.BaseTypes

Iter Query Source #
Instance details

Defined in Control.Iterate.Exp

Ord v => Iter ( BiMap v) Source #
Instance details

Defined in Control.Iterate.BaseTypes

( Ord coin, Ord cred, Ord ptr) => Iter ( View coin cred pool ptr) Source #
Instance details

Defined in Control.Iterate.BaseTypes

Methods

nxt :: View coin cred pool ptr a b -> Collect (a, b, View coin cred pool ptr a b) Source #

lub :: Ord k => k -> View coin cred pool ptr k b -> Collect (k, b, View coin cred pool ptr k b) Source #

hasNxt :: View coin cred pool ptr a b -> Maybe (a, b, View coin cred pool ptr a b) Source #

hasLub :: Ord k => k -> View coin cred pool ptr k b -> Maybe (k, b, View coin cred pool ptr k b) Source #

haskey :: Ord key => key -> View coin cred pool ptr key b -> Bool Source #

isnull :: View coin cred pool ptr k v -> Bool Source #

lookup :: Ord key => key -> View coin cred pool ptr key rng -> Maybe rng Source #

element :: Ord k => k -> View coin cred pool ptr k v -> Collect () Source #

class Basic f where Source #

In order to build typed Exp (which are a typed deep embedding) of Set operations, we need to know what kind of basic types of Maps and Sets can be used this way. Every Basic type has a few operations for creating one from a list, for adding and removing key-value pairs, looking up a value given a key. Instances of this algebra are functional in that every key has exactly one value associated with it.

Minimal complete definition

addkv , removekey , domain , range

Methods

addpair :: Ord k => k -> v -> f k v -> f k v Source #

in addpair the new value always prevails, to make a choice use addkv which has a combining function that allows choice.

addkv :: Ord k => (k, v) -> f k v -> (v -> v -> v) -> f k v Source #

use ( old new -> old) if you want the v in (f k v) to prevail, and use ( old new -> new) if you want the v in (k,v) to prevail

removekey :: Ord k => k -> f k v -> f k v Source #

domain :: Ord k => f k v -> Set k Source #

range :: Ord v => f k v -> Set v Source #

Instances

Instances details
Basic Map Source #
Instance details

Defined in Control.Iterate.BaseTypes

Basic Sett Source #
Instance details

Defined in Control.Iterate.BaseTypes

Basic Single Source #
Instance details

Defined in Control.Iterate.BaseTypes

Basic List Source #

The constructor for List is hidden, since it requires some invariants. Use fromPairs to build an initial List.

Instance details

Defined in Control.Iterate.BaseTypes

Ord v => Basic ( BiMap v) Source #
Instance details

Defined in Control.Iterate.BaseTypes

Methods

addpair :: Ord k => k -> v0 -> BiMap v k v0 -> BiMap v k v0 Source #

addkv :: Ord k => (k, v0) -> BiMap v k v0 -> (v0 -> v0 -> v0) -> BiMap v k v0 Source #

removekey :: Ord k => k -> BiMap v k v0 -> BiMap v k v0 Source #

domain :: Ord k => BiMap v k v0 -> Set k Source #

range :: Ord v0 => BiMap v k v0 -> Set v0 Source #

( Monoid coin, Ord coin, Ord cred, Ord ptr, Ord pool) => Basic ( View coin cred pool ptr) Source #
Instance details

Defined in Control.Iterate.BaseTypes

Methods

addpair :: Ord k => k -> v -> View coin cred pool ptr k v -> View coin cred pool ptr k v Source #

addkv :: Ord k => (k, v) -> View coin cred pool ptr k v -> (v -> v -> v) -> View coin cred pool ptr k v Source #

removekey :: Ord k => k -> View coin cred pool ptr k v -> View coin cred pool ptr k v Source #

domain :: Ord k => View coin cred pool ptr k v -> Set k Source #

range :: Ord v => View coin cred pool ptr k v -> Set v Source #

data BaseRep f k v where Source #

BaseRep witnesses Basic types. I.e. those types that are instances of both Basic and Iter. Pattern matching against a constructor of type BaseRep, determines which base type. For example data Tag f k v = Tag (BaseRep f k v) (f k v) case Tag MapR x -> -- here we know x :: Map.Map k v

data List k v where Source #

Constructors

UnSafeList :: Ord k => [(k, v)] -> List k v

Instances

Instances details
Basic List Source #

The constructor for List is hidden, since it requires some invariants. Use fromPairs to build an initial List.

Instance details

Defined in Control.Iterate.BaseTypes

Iter List Source #
Instance details

Defined in Control.Iterate.BaseTypes

Ord k => Embed [(k, v)] ( List k v) Source #
Instance details

Defined in Control.Iterate.BaseTypes

Methods

toBase :: [(k, v)] -> List k v Source #

fromBase :: List k v -> [(k, v)] Source #

Ord k => HasExp [(k, v)] ( List k v) Source #
Instance details

Defined in Control.Iterate.Exp

Methods

toExp :: [(k, v)] -> Exp ( List k v) Source #

( Eq k, Eq v) => Eq ( List k v) Source #
Instance details

Defined in Control.Iterate.BaseTypes

( Show k, Show v) => Show ( List k v) Source #
Instance details

Defined in Control.Iterate.BaseTypes

fromPairs :: Ord k => (v -> v -> v) -> [(k, v)] -> List k v Source #

normalize :: Ord k => (v -> v -> v) -> [(k, v)] -> [(k, v)] Source #

data Single k v where Source #

Constructors

Single :: k -> v -> Single k v
Fail :: Single k v
SetSingle :: k -> Single k ()

Instances

Instances details
Basic Single Source #
Instance details

Defined in Control.Iterate.BaseTypes

Iter Single Source #
Instance details

Defined in Control.Iterate.BaseTypes

( Eq k, Eq v) => Eq ( Single k v) Source #
Instance details

Defined in Control.Iterate.BaseTypes

( Show k, Show v) => Show ( Single k v) Source #
Instance details

Defined in Control.Iterate.BaseTypes

Ord k => HasQuery ( Single k v) k v Source #
Instance details

Defined in Control.Iterate.Exp

Embed ( Single k v) ( Single k v) Source #
Instance details

Defined in Control.Iterate.BaseTypes

Ord k => HasExp ( Single k v) ( Single k v) Source #
Instance details

Defined in Control.Iterate.Exp

data Sett k v where Source #

Constructors

Sett :: Set k -> Sett k ()

Instances

Instances details
Basic Sett Source #
Instance details

Defined in Control.Iterate.BaseTypes

Iter Sett Source #
Instance details

Defined in Control.Iterate.BaseTypes

Embed ( Set k) ( Sett k ()) Source #
Instance details

Defined in Control.Iterate.BaseTypes

Ord k => HasExp ( Set k) ( Sett k ()) Source #
Instance details

Defined in Control.Iterate.Exp

Eq k => Eq ( Sett k ()) Source #
Instance details

Defined in Control.Iterate.BaseTypes

Show key => Show ( Sett key ()) Source #
Instance details

Defined in Control.Iterate.BaseTypes

class Embed concrete base | concrete -> base where Source #

Methods

toBase :: concrete -> base Source #

fromBase :: base -> concrete Source #

Instances

Instances details
Embed Bool Bool Source #
Instance details

Defined in Control.Iterate.BaseTypes

Ord k => Embed [(k, v)] ( List k v) Source #
Instance details

Defined in Control.Iterate.BaseTypes

Methods

toBase :: [(k, v)] -> List k v Source #

fromBase :: List k v -> [(k, v)] Source #

Embed ( Set k) ( Sett k ()) Source #
Instance details

Defined in Control.Iterate.BaseTypes

Embed ( Map k v) ( Map k v) Source #
Instance details

Defined in Control.Iterate.BaseTypes

Embed ( Single k v) ( Single k v) Source #
Instance details

Defined in Control.Iterate.BaseTypes

Embed ( BiMap v k v) ( BiMap v k v) Source #
Instance details

Defined in Control.Iterate.BaseTypes

Embed ( View coin cred pool ptr k v) ( View coin cred pool ptr k v) Source #
Instance details

Defined in Control.Iterate.BaseTypes

Methods

toBase :: View coin cred pool ptr k v -> View coin cred pool ptr k v Source #

fromBase :: View coin cred pool ptr k v -> View coin cred pool ptr k v Source #