{-# LANGUAGE OverloadedStrings, ScopedTypeVariables #-}
module Haystack.Web.Template where

import Data.Text (Text)
import Happstack.Server
import Text.Blaze.Html5 (Html, (!), a, form, input, p, toHtml, label)
import Text.Blaze.Html5.Attributes (action, enctype, href, name, size, type_, value)
import qualified Text.Blaze.Html5 as H
import qualified Text.Blaze.Html5.Attributes as A

import CSV


template :: Text -> Html -> Response
template title body = toResponse $
  H.html $ do
    H.head $ do
      H.title (toHtml title)
    H.body $ do
      body
      p $ a ! href "/" $ "back home"

serveCSV :: CSV a -> Response
serveCSV = toResponse . showCSV
