{-# LANGUAGE FlexibleContexts, FlexibleInstances, MultiParamTypeClasses #-} {-# OPTIONS_GHC -F -pgmFtrhsx #-} module AppView where import AppState import HSP import System.Locale (defaultTimeLocale) import System.Time (formatCalendarTime, toUTCTime) instance (XMLGenerator m) => (EmbedAsChild m (GuestBookEntry, Bool)) where asChild ((GuestBookEntry author message date), alt) = <%
  • <% author %> said:

    <% map p (lines message) %>
    <% dateStr date %>
  • %> where p str =

    <% str %>

    dateStr ct = formatCalendarTime defaultTimeLocale "%a, %B %d, %Y at %H:%M:%S (UTC)" (toUTCTime ct) instance (XMLGenerator m) => (EmbedAsChild m GuestBook) where asChild (GuestBook entries) = <%

    Words of Wisdom

    %> pageFromBody :: (EmbedAsChild (HSPT' IO) xml) => String -> xml -> HSP XML pageFromBody title body = withMetaData html4Strict $ <% title %>
    14
    Feb

    Happstack Guestbook

    Hey congrats! You're using Happstack 0.1.9. This is a guestbook example which you can freely change to your whims and fancies.

    Leave a message for the next visitor here...



    <% body %>