web-routes-th-0.22.1: Support for deriving PathInfo using Template Haskell

Safe HaskellNone

Web.Routes.TH

Synopsis

Documentation

derivePathInfo :: Name -> Q [Dec]Source

use Template Haskell to create PathInfo instances for a type.

 $(derivePathInfo ''SiteURL)

Uses the standard formatter by default.

derivePathInfo' :: (String -> String) -> Name -> Q [Dec]Source

use Template Haskell to create PathInfo instances for a type.

This variant allows the user to supply a function that transforms the constructor name to a prettier rendering. It is important that the transformation function generates a unique output for each input. For example, simply converting the string to all lower case is not acceptable, because then FooBar and Foobar would be indistinguishable.

 $(derivePathInfo' standard ''SiteURL)

see also: standard

standard :: String -> StringSource

the standard formatter

Converts CamelCase to camel-case.

see also: derivePathInfo and derivePathInfo'