sifflet-lib-1.1: Library of modules shared by sifflet and its tests and its exporters.

Sifflet.Util

Synopsis

Documentation

Parser Utilities

data SuccFail a Source

Constructors

Succ a 
Fail String 

Instances

Monad SuccFail 
Eq a => Eq (SuccFail a) 
Read a => Read (SuccFail a) 
Show a => Show (SuccFail a) 

String Utilities

par :: String -> [String] -> StringSource

Enclose in parentheses, like a Lisp function call. Example: par foo [x, y] = (foo x y)

putCatsLn :: [String] -> IO ()Source

Write a list of words, separated by spaces

putCatLn :: [String] -> IO ()Source

Write a list of words, not separated by spaces

info :: Show t => t -> IO ()Source

Error Reporting

errcat :: [String] -> aSource

Signal an error using a list of strings to be concatenated

errcats :: [String] -> aSource

Signal an error using a list of strings to be concatenated with spaces between (unwords).

List Utilities

map2 :: (a -> b) -> [[a]] -> [[b]]Source

Generalization of map to lists of lists

mapM2 :: Monad m => (a -> m b) -> [[a]] -> m [[b]]Source

Generalization of mapM to lists of lists

adjustAList :: Eq k => k -> (v -> v) -> [(k, v)] -> [(k, v)]Source

Update a value at a given key by applying a function. Similar to Data.Map.adjust.

adjustAListM :: (Eq k, Monad m) => k -> (v -> m v) -> [(k, v)] -> m [(k, v)]Source

Monadic generalization of adjustAList

insertLastLast :: [[a]] -> a -> [[a]]Source

Insert an item into a list of lists of items, making it the last element in the last sublist

insertLast :: [a] -> a -> [a]Source

Insert an item in a list of items, making it the last element