ContentsIndex
Misc
Contents
Lists
Trees
Monads
String
Description
General purpose utilities which don't have to do with refinement itself.
Synopsis
getIndex :: [a] -> Int -> Maybe a
getRange :: [a] -> (Int, Int) -> Maybe [a]
replaceIndex :: Int -> a -> [a] -> [a]
replaceRange :: (Int, Int) -> [a] -> [a] -> [a]
hasLen :: [a] -> Int -> Bool
hasAtLeast :: [a] -> Int -> Bool
pad :: a -> Int -> [a] -> [a]
safeInit :: [a] -> [a]
type NodePos = [Int]
findTreeNode :: (a -> Bool) -> Tree a -> Maybe NodePos
inTree :: NodePos -> Tree a -> Bool
getTreeNode :: NodePos -> Tree a -> a
getTreeNode_ :: NodePos -> Tree a -> Maybe a
updateSubTree :: (Tree a -> Tree a) -> NodePos -> Tree a -> Tree a
zipTreeWith :: (a -> b -> c) -> Tree a -> Tree b -> Tree c
zipTree :: Tree a -> Tree b -> Tree (a, b)
numberTree :: Tree a -> Tree Int
nodePos2Number :: Tree a -> NodePos -> Int
updateRootLabel :: (a -> a) -> Tree a -> Tree a
updateSubForest :: ([Tree a] -> [Tree a]) -> Tree a -> Tree a
data BreakLoopException = BreakLoopException
data ContLoopException = ContLoopException
loop :: MonadException m => m () -> m ()
breakLoop :: MonadException m => m a
continueLoop :: MonadException m => m a
trim :: String -> String
tokenize :: String -> [String]
tryReadP :: ReadP a -> String -> Either String a
runReadP :: ReadP a -> String -> a
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
:: aelement to pad with
-> Intdesired 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
BreakLoopException
show/hide Instances
data ContLoopException
Constructors
ContLoopException
show/hide 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