Webanwendung mit FastCGI und Haskell
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

24 lignes
715B

  1. {-# LANGUAGE OverloadedStrings #-}
  2. import qualified Data.ByteString as B
  3. import Blaze.ByteString.Builder (toByteStringIO)
  4. import Control.Applicative
  5. import Control.Monad.Trans.Either (runEitherT)
  6. import Heist
  7. import Heist.Compiled (renderTemplate)
  8. import Control.Lens
  9. heistConfig =
  10. (set hcNamespace "") $
  11. -- (set hcInterpretedSplices defaultInterpretedSplices) $
  12. (set hcLoadTimeSplices defaultLoadTimeSplices) $
  13. (set hcTemplateLocations [loadTemplates "."]) $
  14. emptyHeistConfig
  15. main = do
  16. heistState <- either (error "oops") id <$>
  17. (runEitherT $ initHeist heistConfig)
  18. builder <- maybe (error "oops") fst $
  19. renderTemplate heistState "billy"
  20. toByteStringIO B.putStr builder