/usr/share/doc/libghc-hastache-doc/html/Text-Hastache-Context.html is in libghc-hastache-doc 0.3.3-4build2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Text.Hastache.Context</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_Text-Hastache-Context.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Text-Hastache-Context.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">hastache-0.3.3: Haskell implementation of Mustache templates</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Safe Haskell</th><td>None</td></tr></table><p class="caption">Text.Hastache.Context</p></div><div id="description"><p class="caption">Description</p><div class="doc"><p>Hastache context helpers
</p></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><a href="#v:mkStrContext">mkStrContext</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad.html#t:Monad">Monad</a> m => (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-String.html#t:String">String</a> -> <a href="Text-Hastache.html#t:MuType">MuType</a> m) -> <a href="Text-Hastache.html#t:MuContext">MuContext</a> m</li><li class="src short"><a href="#v:mkGenericContext">mkGenericContext</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad.html#t:Monad">Monad</a> m, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Data.html#t:Data">Data</a> a, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Typeable-Internal.html#t:Typeable1">Typeable1</a> m) => a -> <a href="Text-Hastache.html#t:MuContext">MuContext</a> m</li></ul></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src"><a name="v:mkStrContext" class="def">mkStrContext</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad.html#t:Monad">Monad</a> m => (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-String.html#t:String">String</a> -> <a href="Text-Hastache.html#t:MuType">MuType</a> m) -> <a href="Text-Hastache.html#t:MuContext">MuContext</a> m<a href="src/Text-Hastache-Context.html#mkStrContext" class="link">Source</a></p><div class="doc"><p>Make Hastache context from String -> MuType function
</p></div></div><div class="top"><p class="src"><a name="v:mkGenericContext" class="def">mkGenericContext</a> :: (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Control-Monad.html#t:Monad">Monad</a> m, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Data.html#t:Data">Data</a> a, <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Typeable-Internal.html#t:Typeable1">Typeable1</a> m) => a -> <a href="Text-Hastache.html#t:MuContext">MuContext</a> m<a href="src/Text-Hastache-Context.html#mkGenericContext" class="link">Source</a></p><div class="doc"><p>Make Hastache context from Data.Data deriving type
</p><p>Supported field types:
</p><ul><li> String
</li><li> Char
</li><li> Double
</li><li> Float
</li><li> Int
</li><li> Int8
</li><li> Int16
</li><li> Int32
</li><li> Int64
</li><li> Integer
</li><li> Word
</li><li> Word8
</li><li> Word16
</li><li> Word32
</li><li> Word64
</li><li> Data.ByteString.ByteString
</li><li> Data.ByteString.Lazy.ByteString
</li><li> Data.Text.Text
</li><li> Data.Text.Lazy.Text
</li><li> Bool
</li><li> Data.ByteString.ByteString -> Data.ByteString.ByteString
</li><li> String -> String
</li><li> Data.ByteString.ByteString -> Data.ByteString.Lazy.ByteString
</li><li> MonadIO m => Data.ByteString.ByteString -> m Data.ByteString.ByteString
</li><li> MonadIO m => String -> m String
</li><li> MonadIO m => Data.ByteString.ByteString -> m Data.ByteString.Lazy.ByteString
</li></ul><p>Example:
</p><pre>
import Text.Hastache
import Text.Hastache.Context
import qualified Data.ByteString as B
import qualified Data.ByteString.Lazy as LZ
import Data.Data
import Data.Generics
import Data.Char
data InternalData = InternalData {
someField :: String,
anotherField :: Int
} deriving (Data, Typeable, Show)
data Example = Example {
stringField :: String,
intField :: Int,
dataField :: InternalData,
simpleListField :: [String],
dataListField :: [InternalData],
stringFunc :: String -> String,
byteStringFunc :: B.ByteString -> B.ByteString,
monadicStringFunc :: String -> IO String,
monadicByteStringFunc :: B.ByteString -> IO B.ByteString
} deriving (Data, Typeable)
example = hastacheStr defaultConfig (encodeStr template)
(mkGenericContext context)
where
template = concat $ map (++ "\n") [
"string: {{stringField}}",
"int: {{intField}}",
"data: {{dataField.someField}}, {{dataField.anotherField}}",
"data: {{#dataField}}{{someField}}, {{anotherField}}{{/dataField}}",
"simple list: {{#simpleListField}}{{.}} {{/simpleListField}}",
"data list:",
"{{#dataListField}}",
" * {{someField}}, {{anotherField}}. top level var: {{intField}}",
"{{/dataListField}}",
"{{#stringFunc}}upper{{/stringFunc}}",
"{{#byteStringFunc}}reverse{{/byteStringFunc}}",
"{{#monadicStringFunc}}upper (monadic){{/monadicStringFunc}}",
"{{#monadicByteStringFunc}}reverse (monadic){{/monadicByteStringFunc}}"]
context = Example { stringField = "string value", intField = 1,
dataField = InternalData "val" 123, simpleListField = ["a","b","c"],
dataListField = [InternalData "aaa" 1, InternalData "bbb" 2],
stringFunc = map toUpper,
byteStringFunc = B.reverse,
monadicStringFunc = return . map toUpper,
monadicByteStringFunc = return . B.reverse }
main = example >>= LZ.putStrLn
</pre><p>Result:
</p><pre>
string: string value
int: 1
data: val, 123
data: val, 123
simple list: a b c
data list:
* aaa, 1. top level var: 1
* bbb, 2. top level var: 1
UPPER
esrever
UPPER (MONADIC)
)cidanom( esrever
</pre></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.13.2</p></div></body></html>
|