Skip to content

Instantly share code, notes, and snippets.

@mikeplus64
Created April 5, 2015 02:25
Show Gist options
  • Save mikeplus64/5f0e4a4d196fd5469adc to your computer and use it in GitHub Desktop.
Save mikeplus64/5f0e4a4d196fd5469adc to your computer and use it in GitHub Desktop.
compiled heist not working?
<apply template="thingo">
<hello/>
</apply>
{-# LANGUAGE OverloadedStrings #-}
import Blaze.ByteString.Builder
import Control.Lens
import Control.Monad.Trans.Either
import qualified Data.ByteString as B
import Data.Map.Syntax
import Heist
import Heist.Compiled
main = do
let hc = emptyHeistConfig
& hcTemplateLocations .~ [loadTemplates "."]
& hcCompiledSplices .~ do
"hello" ## return (yieldPureText "aaaaaaaaa")
hs <- either (error "oops") id `fmap` runEitherT (initHeist hc)
builder <- maybe (error "oops") fst (renderTemplate hs "default")
toByteStringIO B.putStr builder
<apply template='thingo'>
<hello></hello>
</apply>&#10;
<div class="foob">
<p> asdf hdg jsdg jsdgb </p>
<apply-content/>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment