-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Haml-like template files that are compile-time checked -- -- Hamlet gives you a type-safe tool for generating HTML code. It works -- via Quasi-Quoting, and generating extremely efficient output code. The -- syntax is white-space sensitive, and it helps you avoid cross-site -- scripting issues and 404 errors. Please see the documentation at -- http://docs.yesodweb.com/hamlet/ for more details. -- -- As a quick overview, here is a sample Hamlet template: -- --
--   !!!
--   %html
--       %head
--           %title Hamlet Demo
--       %body
--           %h1 Information on $name.person$
--           %p $*name.person$ is $age.person$ years old.
--           %h2
--               $if isMarried.person
--                   Married
--               $else
--                   Not married
--           %ul
--               $forall children.person child
--                   %li $child$
--           %p
--               %a!href=@page.person@ See the page.
--           ^footer^
--   
@package hamlet @version 0.2.3 module Text.Hamlet.Parse data Result v Error :: String -> Result v Ok :: v -> Result v newtype Deref -- | is monadic, ident Deref :: [(Bool, Ident)] -> Deref newtype Ident Ident :: String -> Ident data Content ContentRaw :: String -> Content ContentVar :: Deref -> Content -- | bool: does it include params? ContentUrl :: Bool -> Deref -> Content ContentEmbed :: Deref -> Content data Doc DocForall :: Deref -> Ident -> [Doc] -> Doc DocCond :: [(Deref, [Doc])] -> (Maybe [Doc]) -> Doc DocMaybe :: Deref -> Ident -> [Doc] -> (Maybe [Doc]) -> Doc DocContent :: [Content] -> Doc parseDoc :: HamletSettings -> String -> Result [Doc] -- | Settings for parsing of a hamlet document. data HamletSettings HamletSettings :: String -> Bool -> HamletSettings -- | The value to replace a "!!!" with. Do not include the trailing -- newline. hamletDoctype :: HamletSettings -> String -- | True means to close empty tags (eg, img) with a trailing slash, -- ie XML-style empty tags. False uses HTML-style. hamletCloseEmpties :: HamletSettings -> Bool -- | Defaults settings: HTML5 doctype and HTML-style empty tags. defaultHamletSettings :: HamletSettings instance Typeable Doc instance Typeable Content instance Typeable Ident instance Typeable Deref instance Typeable1 Result instance Show Doc instance Eq Doc instance Read Doc instance Data Doc instance Eq Line instance Show Line instance Read Line instance Show Content instance Eq Content instance Read Content instance Data Content instance Show Ident instance Eq Ident instance Read Ident instance Data Ident instance Show Deref instance Eq Deref instance Read Deref instance Data Deref instance (Show v) => Show (Result v) instance (Eq v) => Eq (Result v) instance (Read v) => Read (Result v) instance (Data v) => Data (Result v) instance Applicative Result instance Functor Result instance Monad Result module Text.Hamlet.Monad -- | Something to be run for each val. Returns Left when enumeration -- should terminate immediately, Right when it can receive more -- input. type Iteratee val seed m = seed -> val -> m (Either seed seed) -- | Generates a stream of values to be passed to an Iteratee. newtype Enumerator val m Enumerator :: (forall seed. Iteratee val seed m -> seed -> m (Either seed seed)) -> Enumerator val m runEnumerator :: Enumerator val m -> forall seed. Iteratee val seed m -> seed -> m (Either seed seed) -- | Convert a list into an Enumerator. fromList :: (Monad m) => [a] -> Enumerator a m -- | Hamlet is a monad that has two features: -- -- -- -- The URL to String function makes it very convenient to write templates -- without knowing the absolute URLs for all referenced resources. For -- more information on this approach, please see the web-routes package. -- -- For efficiency, the Hamlet monad halts execution as soon as the -- underlying Iteratee returns a Left value. This is -- normally what you want; this might cause a problem if you are relying -- on the side effects of a Hamlet action. However, it is not -- recommended to rely on side-effects. Though a Hamlet monad may -- perform IO actions, this should only be used for read-only behavior -- for efficiency. newtype Hamlet url m a Hamlet :: (forall seed. (url -> String) -> seed -> Iteratee Text seed m -> m (Either seed (a, seed))) -> Hamlet url m a runHamlet :: Hamlet url m a -> forall seed. (url -> String) -> seed -> Iteratee Text seed m -> m (Either seed (a, seed)) -- | Content for an HTML document. Encoded content should not be -- entity escaped; Unencoded should be. data HtmlContent Encoded :: Text -> HtmlContent Unencoded :: Text -> HtmlContent -- | Directly output strict Text without any escaping. output :: (Monad m) => Text -> Hamlet url m () -- | Outputs the given HtmlContent, entity encoding any -- Unencoded data. outputHtml :: (Monad m) => HtmlContent -> Hamlet url m () -- | pack a String and call output; this will not -- perform any escaping. outputString :: (Monad m) => String -> Hamlet url m () -- | Uses the URL rendering function to convert the given URL to a -- String and then calls outputString. outputUrl :: (Monad m) => url -> Hamlet url m () -- | Same as outputUrl, but appends a query-string with given keys -- and values. outputUrlParams :: (Monad m) => (url, [(String, String)]) -> Hamlet url m () -- | Only really used to ensure that the argument has the right type. outputEmbed :: (Monad m) => Hamlet url m () -> Hamlet url m () -- | Returns HTML-ready text (ie, all entities are escaped properly). htmlContentToText :: HtmlContent -> Text -- | Use the URL to String rendering function to convert a URL to a -- String. showUrl :: (Monad m) => url -> Hamlet url m String -- | Lift a monadic action into the Hamlet monad. liftHamlet :: (Monad m) => m a -> Hamlet url m a -- | Perform the given Hamlet action for all values generated by the -- given Enumerator. mapH :: (Monad m) => (val -> Hamlet url m ()) -> Enumerator val m -> Hamlet url m () -- | Checks for truth in the left value in each pair in the first argument. -- If a true exists, then the corresponding right action is performed. -- Only the first is performed. In there are no true values, then the -- second argument is performed, if supplied. condH :: (Monad m) => [(m Bool, Hamlet url m ())] -> Maybe (Hamlet url m ()) -> Hamlet url m () -- | Runs the second argument with the value in the first, if available. maybeH :: (Monad m) => Maybe v -> (v -> Hamlet url m ()) -> Hamlet url m () -- | Runs the second argument with the value in the first, if available. -- Otherwise, runs the third argument, if available. maybeH' :: (Monad m) => Maybe v -> (v -> Hamlet url m ()) -> Maybe (Hamlet url m ()) -> Hamlet url m () -- | Prints a Hamlet to standard out. Good for debugging. printHamlet :: (url -> String) -> Hamlet url IO () -> IO () -- | Converts a Hamlet to lazy text, using strict I/O. hamletToText :: (Monad m) => (url -> String) -> Hamlet url m () -> m Text -- | Wrap some HtmlContent for embedding in an XML file. cdata :: HtmlContent -> HtmlContent instance Eq HtmlContent instance Show HtmlContent instance Read HtmlContent instance Monoid HtmlContent instance (Monad m) => Applicative (Hamlet url m) instance (Monad m) => Functor (Hamlet url m) instance (Monad m) => Monad (Hamlet url m) module Text.Hamlet.Quasi -- | Calls hamletWithSettings with defaultHamletSettings. hamlet :: QuasiQuoter -- | Calls hamletWithSettings using XHTML 1.0 Strict settings. xhamlet :: QuasiQuoter -- | A quasi-quoter that converts Hamlet syntax into a function of form: -- -- argument -> Hamlet url m () -- -- Please see accompanying documentation for a description of Hamlet -- syntax. You must ensure that the type of m, url and argument all work -- properly with the functions referred to in the template. Of course, -- worst case scenario is the compiler will catch your mistakes. hamletWithSettings :: HamletSettings -> QuasiQuoter module Text.Hamlet -- | Calls hamletWithSettings with defaultHamletSettings. hamlet :: QuasiQuoter -- | Calls hamletWithSettings using XHTML 1.0 Strict settings. xhamlet :: QuasiQuoter -- | A quasi-quoter that converts Hamlet syntax into a function of form: -- -- argument -> Hamlet url m () -- -- Please see accompanying documentation for a description of Hamlet -- syntax. You must ensure that the type of m, url and argument all work -- properly with the functions referred to in the template. Of course, -- worst case scenario is the compiler will catch your mistakes. hamletWithSettings :: HamletSettings -> QuasiQuoter -- | Settings for parsing of a hamlet document. data HamletSettings HamletSettings :: String -> Bool -> HamletSettings -- | The value to replace a "!!!" with. Do not include the trailing -- newline. hamletDoctype :: HamletSettings -> String -- | True means to close empty tags (eg, img) with a trailing slash, -- ie XML-style empty tags. False uses HTML-style. hamletCloseEmpties :: HamletSettings -> Bool -- | Defaults settings: HTML5 doctype and HTML-style empty tags. defaultHamletSettings :: HamletSettings -- | Hamlet is a monad that has two features: -- -- -- -- The URL to String function makes it very convenient to write templates -- without knowing the absolute URLs for all referenced resources. For -- more information on this approach, please see the web-routes package. -- -- For efficiency, the Hamlet monad halts execution as soon as the -- underlying Iteratee returns a Left value. This is -- normally what you want; this might cause a problem if you are relying -- on the side effects of a Hamlet action. However, it is not -- recommended to rely on side-effects. Though a Hamlet monad may -- perform IO actions, this should only be used for read-only behavior -- for efficiency. newtype Hamlet url m a Hamlet :: (forall seed. (url -> String) -> seed -> Iteratee Text seed m -> m (Either seed (a, seed))) -> Hamlet url m a runHamlet :: Hamlet url m a -> forall seed. (url -> String) -> seed -> Iteratee Text seed m -> m (Either seed (a, seed)) -- | Content for an HTML document. Encoded content should not be -- entity escaped; Unencoded should be. data HtmlContent Encoded :: Text -> HtmlContent Unencoded :: Text -> HtmlContent -- | Prints a Hamlet to standard out. Good for debugging. printHamlet :: (url -> String) -> Hamlet url IO () -> IO () -- | Generates a stream of values to be passed to an Iteratee. newtype Enumerator val m Enumerator :: (forall seed. Iteratee val seed m -> seed -> m (Either seed seed)) -> Enumerator val m runEnumerator :: Enumerator val m -> forall seed. Iteratee val seed m -> seed -> m (Either seed seed) -- | Convert a list into an Enumerator. fromList :: (Monad m) => [a] -> Enumerator a m