gitit

Safe Haskell | Safe-Infered

Network.Gitit.Util

Synopsis

- readFileUTF8 :: FilePath -> IO String
- inDir :: FilePath -> IO a -> IO a
- withTempDir :: FilePath -> (FilePath -> IO a) -> IO a
- orIfNull :: [a] -> [a] -> [a]
- splitCategories :: String -> [String]
- trim :: String -> String
- yesOrNo :: Bool -> String
- parsePageType :: String -> (PageType, Bool)

# Documentation

readFileUTF8 :: FilePath -> IO String

Read file as UTF-8 string. Encode filename as UTF-8.

inDir :: FilePath -> IO a -> IO a

Perform a function a directory and return to working directory.

withTempDir :: FilePath -> (FilePath -> IO a) -> IO a

Perform a function in a temporary directory and clean up.

orIfNull :: [a] -> [a] -> [a]

Returns a list, if it is not null, or a backup, if it is.

splitCategories :: String -> [String]

Split a string containing a list of categories.

trim :: String -> String

Trim leading and trailing spaces.

yesOrNo :: Bool -> String

Show Bool as yes or no.

parsePageType :: String -> (PageType, Bool)