frame-0.1: A simple web framework.

Frame.Utilities

Contents

Description

Common helper functions

Synopsis

String helpers

explodeSource

Arguments

:: Char

The character to split against

-> String

The string to split

-> [String]

The resultant list

Similar to words except splitting against arbitrary Char

explodeURL :: String -> [String]Source

Explode for URLs

explodeFieldNameSource

Arguments

:: String

The FieldName

-> (Int, [String])

(Length of the list, Resultant list)

Explode for field names

implode :: Char -> [String] -> StringSource

Opposite of explode

implodeUrl :: [String] -> StringSource

Implode for URLs

humanise :: String -> StringSource

''hi there'' to ''Hi There''

humaniseCamel :: String -> StringSource

''camelCase'' to ''Camel Case''

humaniseUrl :: String -> String -> StringSource

''/a/url'' to ''A Url''

humanisePath :: [String] -> String -> StringSource

[''a'', ''url''] to ''A Url''

Maybe helpers

headMaybe :: [a] -> Maybe aSource

Safe head

pop :: Monad m => m [a] -> m (Maybe a)Source

Monadic safe head

appMaybe :: (a -> b) -> Maybe a -> Maybe bSource

Function application within Maybe

allNothing :: [Maybe a] -> BoolSource

List of Nothing == True

Failure helpers

(?)Source

Arguments

:: Bool

Test

-> String

String on failure

-> Maybe String

Nothing if success, (Just ''message'') on success

Captures failure

(??) :: Bool -> String -> StringSource

Same as (?), always returns a string ('''' on success)

module Data.Map

module Data.Maybe