EllaSource codeContentsIndex
Ella.GenUtils
Description
General utility functions that do not depend on other functions in Web modules
Synopsis
utf8 :: String -> ByteString
apply :: [a -> a] -> a -> a
with :: a -> [a -> a] -> a
exactParse :: (Read a, Monad m) => String -> m a
nullToNothing :: String -> Maybe String
getTimestamp :: IO Int
randomStr :: Int -> IO String
Documentation
utf8 :: String -> ByteStringSource
Takes a String and returns UTF8 ByteString
applySource
::
=> [a -> a]List of functions
-> aInitial value
-> a
Apply a list of transformation functions to a value
with :: a -> [a -> a] -> aSource
Same as apply with arguments flipped
exactParse :: (Read a, Monad m) => String -> m aSource

Parse a value, or fail if the entire string cannot be parsed

Note that this relies on reads, which appears to be buggy for Int -- it works something like parsing as Integer, then wrapping to a 32 bit Int. The Param instance for Int has fixed this, so you can use capture instead.

nullToNothing :: String -> Maybe StringSource
Converts empty string to Nothing, everything else wrapped in Just
getTimestamp :: IO IntSource
Return current time as a UNIX timestamp
randomStr :: Int -> IO StringSource
Returns a randomly generated string of length n
Produced by Haddock version 2.4.2