|
|
|
|
|
| Description |
| General purpose utilities which don't have to do with refinement itself.
|
|
| Synopsis |
|
|
|
|
| Lists
|
|
| getIndex :: [a] -> Int -> Maybe a |
|
| getRange :: [a] -> (Int, Int) -> Maybe [a] |
| Assumes that the first int is <= the last
|
|
| replaceIndex :: Int -> a -> [a] -> [a] |
| Assumes the index is correct as applied to this list.
For error check use getIndex
|
|
| replaceRange |
| :: (Int, Int) | | | -> [a] | replacement
| | -> [a] | list to replace in
| | -> [a] | | | Assumes the range is correct as applied to this list.
For error check use getRange
|
|
|
| hasLen :: [a] -> Int -> Bool |
|
| hasAtLeast :: [a] -> Int -> Bool |
|
| pad |
| :: a | element to pad with
| | -> Int | desired length
| | -> [a] | list to pad
| | -> [a] | padded list
|
|
|
| safeInit :: [a] -> [a] |
| id on empty lists and init on non-empty lists.
|
|
| Trees
|
|
| type NodePos = [Int] |
| Address of a node in the tree, read from left to right.
|
|
| findTreeNode :: (a -> Bool) -> Tree a -> Maybe NodePos |
|
| inTree :: NodePos -> Tree a -> Bool |
|
| getTreeNode :: NodePos -> Tree a -> a |
| Doesn't check bounds, use inTree for that.
|
|
| getTreeNode_ :: NodePos -> Tree a -> Maybe a |
|
| updateSubTree :: (Tree a -> Tree a) -> NodePos -> Tree a -> Tree a |
| Doesn't check bounds, use inTree for that.
|
|
| zipTreeWith :: (a -> b -> c) -> Tree a -> Tree b -> Tree c |
|
| zipTree :: Tree a -> Tree b -> Tree (a, b) |
|
| numberTree :: Tree a -> Tree Int |
| Numbers all the tree nodes in preorder starting with 1.
|
|
| nodePos2Number :: Tree a -> NodePos -> Int |
|
| updateRootLabel :: (a -> a) -> Tree a -> Tree a |
|
| updateSubForest :: ([Tree a] -> [Tree a]) -> Tree a -> Tree a |
|
| Monads
|
|
| data BreakLoopException |
| Constructors | | Instances | |
|
|
| data ContLoopException |
| Constructors | | Instances | |
|
|
| loop :: MonadException m => m () -> m () |
| Implementation of an imperative style loop
with break and continue. Uses exceptions.
|
|
| breakLoop :: MonadException m => m a |
|
| continueLoop :: MonadException m => m a |
|
| String
|
|
| trim :: String -> String |
|
| tokenize :: String -> [String] |
|
| tryReadP :: ReadP a -> String -> Either String a |
|
| runReadP :: ReadP a -> String -> a |
|
| Produced by Haddock version 0.8 |