sifflet-2.3.0: Simple, visual, functional language for learning about recursion.

Safe HaskellSafe
LanguageHaskell2010

Language.Sifflet.Util

Synopsis

Documentation

Parser Utilities

String Utilities

par :: String -> [String] -> String Source

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

fake :: String -> IO () Source

stub :: String -> IO () Source

Error Reporting

errcat :: [String] -> a Source

Signal an error using a list of strings to be concatenated

errcats :: [String] -> a Source

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