Safe Haskell | Safe |
---|
- data OrdCons a r w p1 p2 tc
- initOrdCons :: (Ord a, Monad p1, Monad p2) => OrdCons a r w p1 p2 tc -> p1 (OrdConsTable a) -> MultiPassPrologue r w tc ()
- ordCons :: (Ord a, Monad p1, Monad p2) => OrdCons a r w p1 p2 tc -> p1 a -> MultiPass r w tc (p2 Int)
- getOrdConsTable :: OrdCons a r w p1 p2 tc -> MultiPassEpilogue r w tc (p2 (OrdConsTable a))
- data OrdConsTable a
- lookupOrdConsTable :: Ord a => OrdConsTable a -> a -> Maybe Int
- insertOrdConsTable :: Ord a => OrdConsTable a -> a -> OrdConsTable a
- growOrdConsTable :: Ord a => OrdConsTable a -> Map a () -> OrdConsTable a
Documentation
data OrdCons a r w p1 p2 tc Source
Abstract datatype for the instrument.
Instrument tc () () (OrdCons a r w Off Off tc) |
:: (Ord a, Monad p1, Monad p2) | |
=> OrdCons a r w p1 p2 tc | Instrument |
-> p1 (OrdConsTable a) | Initial table |
-> MultiPassPrologue r w tc () |
Initialise the OrdCons
instrument with an OrdConsTable
. This
method is optional. Ff this method is not used then the instrument
will be initialised with an empty OrdConsTable
.
:: (Ord a, Monad p1, Monad p2) | |
=> OrdCons a r w p1 p2 tc | Instrument |
-> p1 a | Value |
-> MultiPass r w tc (p2 Int) | Unique index |
Get a unique index for the value.
getOrdConsTable :: OrdCons a r w p1 p2 tc -> MultiPassEpilogue r w tc (p2 (OrdConsTable a))Source
Get the final OrdConsTable
.
data OrdConsTable a Source
lookupOrdConsTable :: Ord a => OrdConsTable a -> a -> Maybe IntSource
Lookup an element.
insertOrdConsTable :: Ord a => OrdConsTable a -> a -> OrdConsTable aSource
Insert an element. If the element is not in the map yet, then it
is assigned index n
, where n
is the original size of the table.
growOrdConsTable :: Ord a => OrdConsTable a -> Map a () -> OrdConsTable aSource
Add multiple elements. The new elements are assigned indices
n..n+k-1
, where n
is the original size of the table and k
is
the number of new elements to be added. This function will assert
if any of the new elements are already in the table.