Commits

basvandijk committed 6b532e1

Use hastache-0.5

Comments (0)

Files changed (1)

Criterion/Report.hs

 import System.FilePath ((</>), isPathSeparator)
 import System.IO.Unsafe (unsafePerformIO)
 import Text.Hastache (MuType(..))
-import Text.Hastache.Context (mkGenericContext, mkStrContext)
+import Text.Hastache.Context (mkGenericContext, mkStrContext, mkStrContextM)
 import qualified Control.Exception as E
 import qualified Data.ByteString.Char8 as B
 import qualified Data.ByteString.Lazy as L
              -> B.ByteString    -- ^ Hastache template.
              -> IO L.ByteString
 formatReport reports template = do
-  let context "report"  = MuList $ map inner reports
-      context "include" = MuLambdaM $ includeFile [templateDir]
-      context _         = MuNothing
-      inner Report{..} = mkStrContext $ \nym ->
+  let context "report"  = return $ MuList $ map inner reports
+      context "include" = return $ MuLambdaM $ includeFile [templateDir]
+      context _         = return $ MuNothing
+      inner Report{..} = mkStrContextM $ \nym ->
                          case nym of
-                           "name"     -> MuVariable reportName
-                           "number"   -> MuVariable reportNumber
-                           "times"    -> vector "x" reportTimes
-                           "kdetimes" -> vector "x" kdeTimes
-                           "kdepdf"   -> vector "x" kdePDF
-                           "kde"      -> vector2 "time" "pdf" kdeTimes kdePDF
+                           "name"     -> return $ MuVariable reportName
+                           "number"   -> return $ MuVariable reportNumber
+                           "times"    -> return $ vector "x" reportTimes
+                           "kdetimes" -> return $ vector "x" kdeTimes
+                           "kdepdf"   -> return $ vector "x" kdePDF
+                           "kde"      -> return $ vector2 "time" "pdf" kdeTimes kdePDF
                            ('a':'n':_)-> mkGenericContext reportAnalysis $
                                          H.encodeStr nym
                            _          -> mkGenericContext reportOutliers $
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.