Webanwendung mit FastCGI und Haskell
Nie możesz wybrać więcej, niż 25 tematów
Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
|
- {-# LANGUAGE OverloadedStrings #-}
-
- import qualified Data.ByteString as B
- import Blaze.ByteString.Builder (toByteStringIO)
- import Control.Applicative
- import Control.Monad.Trans.Either (runEitherT)
- import Heist
- import Heist.Compiled (renderTemplate)
- import Control.Lens
-
- heistConfig =
- (set hcNamespace "") $
- -- (set hcInterpretedSplices defaultInterpretedSplices) $
- (set hcLoadTimeSplices defaultLoadTimeSplices) $
- (set hcTemplateLocations [loadTemplates "."]) $
- emptyHeistConfig
-
- main = do
- heistState <- either (error "oops") id <$>
- (runEitherT $ initHeist heistConfig)
- builder <- maybe (error "oops") fst $
- renderTemplate heistState "billy"
- toByteStringIO B.putStr builder
|