Created
April 5, 2015 02:25
-
-
Save mikeplus64/5f0e4a4d196fd5469adc to your computer and use it in GitHub Desktop.
compiled heist not working?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<apply template="thingo"> | |
<hello/> | |
</apply> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<apply template='thingo'> | |
<hello></hello> | |
</apply> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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