parameterized-utils-1.0.0: Classes and data structures for working with data-kind indexed types

Copyright(c) Galois Inc 2014
MaintainerJoe Hendrix <jhendrix@galois.com>
Safe HaskellSafe
LanguageHaskell98

Data.Parameterized.Utils.BinTree

Description

 

Synopsis

Documentation

data MaybeS v Source #

A strict version of Maybe

Constructors

JustS !v 
NothingS 

Instances

Functor MaybeS Source # 

Methods

fmap :: (a -> b) -> MaybeS a -> MaybeS b #

(<$) :: a -> MaybeS b -> MaybeS a #

Applicative MaybeS Source # 

Methods

pure :: a -> MaybeS a #

(<*>) :: MaybeS (a -> b) -> MaybeS a -> MaybeS b #

liftA2 :: (a -> b -> c) -> MaybeS a -> MaybeS b -> MaybeS c #

(*>) :: MaybeS a -> MaybeS b -> MaybeS b #

(<*) :: MaybeS a -> MaybeS b -> MaybeS a #

Alternative MaybeS Source # 

Methods

empty :: MaybeS a #

(<|>) :: MaybeS a -> MaybeS a -> MaybeS a #

some :: MaybeS a -> MaybeS [a] #

many :: MaybeS a -> MaybeS [a] #

fromMaybeS :: a -> MaybeS a -> a Source #

data Updated a Source #

Updated a contains a value that has been flagged on whether it was modified by an operation.

Constructors

Updated !a 
Unchanged !a 

data TreeApp e t Source #

Constructors

BinTree !e !t !t 
TipTree 

class IsBinTree t e | t -> e where Source #

Minimal complete definition

asBin, tip, bin, size

Methods

asBin :: t -> TreeApp e t Source #

tip :: t Source #

bin :: e -> t -> t -> t Source #

size :: t -> Int Source #

Instances

IsBinTree (MapF k1 k2 a) (Pair k1 k2 a) Source # 

Methods

asBin :: MapF k1 k2 a -> TreeApp (Pair k1 k2 a) (MapF k1 k2 a) Source #

tip :: MapF k1 k2 a Source #

bin :: Pair k1 k2 a -> MapF k1 k2 a -> MapF k1 k2 a -> MapF k1 k2 a Source #

size :: MapF k1 k2 a -> Int Source #

balanceL :: IsBinTree c e => e -> c -> c -> c Source #

balanceR :: IsBinTree c e => e -> c -> c -> c Source #

glue :: IsBinTree c e => c -> c -> c Source #

'glue l r' concatenates l and r.

It assumes that l and r are already balanced with respect to each other.

merge :: IsBinTree c e => c -> c -> c Source #

Concatenate two trees that are ordered with respect to each other.

filterGt :: IsBinTree c e => (e -> Ordering) -> c -> MaybeS c Source #

Returns only entries that are less than predicate with respect to the ordering and Nothing if no elements are discared.

filterLt :: IsBinTree c e => (e -> Ordering) -> c -> MaybeS c Source #

filterLt' k m returns submap of m that only contains entries that are smaller than k. If no entries are deleted then return Nothing.

insert :: IsBinTree c e => (e -> e -> Ordering) -> e -> c -> Updated c Source #

insert p m inserts the binding into m. It returns an Unchanged value if the map stays the same size and an updated value if a new entry was inserted.

delete Source #

Arguments

:: IsBinTree c e 
=> (e -> Ordering)

Predicate that returns whether the entry is less than, greater than, or equal to the key we are entry that we are looking for.

-> c 
-> MaybeS c 

union :: IsBinTree c e => (e -> e -> Ordering) -> c -> c -> c Source #

Union two sets

link :: IsBinTree c e => e -> c -> c -> c Source #

link is called to insert a key and value between two disjoint subtrees.

data PairS f s Source #

A Strict pair

Constructors

PairS !f !s