happstack-util-0.2.1: Web framework

Happstack.Util.Common

Description

Various helper routines.

Synopsis

Documentation

hPutLine :: Handle -> String -> IO ()Source

Put a line into a handle followed by rn and echo to stdout

hGetLn :: Handle -> IO StringSource

Get a line from the handle and echo to stdout

splitList :: Eq a => a -> [a] -> [[a]]Source

splitListBy :: (a -> Bool) -> [a] -> [[a]]Source

split :: (a -> Bool) -> [a] -> ([a], [a])Source

Split is like break, but the matching element is dropped.

mbReadFile :: a -> (String -> a) -> FilePath -> IO aSource

Read file with a default value if the file does not exist.

doSnd :: (a -> b) -> (c, a) -> (c, b)Source

doFst :: (a -> b) -> (a, c) -> (b, c)Source

mapFst :: (a -> b) -> [(a, x)] -> [(b, x)]Source

mapSnd :: (a -> b) -> [(x, a)] -> [(x, b)]Source

revmap :: a -> [a -> b] -> [b]Source

comp :: Ord t => (a -> t) -> a -> a -> OrderingSource

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

Run an external command. Upon failure print status to stderr.

debug :: Show a => String -> a -> aSource

Unsafe tracing, outputs the message and the value to stderr.

debugM :: Monad m => String -> m ()Source

Unsafe tracing messages inside a monad.

readM :: (Monad m, Read t) => String -> m tSource

Read in any monad.

maybeM :: Monad m => Maybe a -> m aSource

Convert Maybe into an another monad.

notMb :: a -> Maybe a -> Maybe aSource

periodic' :: [Int] -> IO a -> IO aSource