Bryan O'Sullivan avatar Bryan O'Sullivan committed d7c0854

Add docs.

Comments (0)

Files changed (1)

Criterion/Report.hs

     return name
   note "report written to %s\n" rep
 
+-- | Render the elements of a vector.
+--
+-- For example, given this piece of Haskell:
+--
+-- @'mkStrContext' $ \\name ->
+-- case name of
+--   \"foo\" -> 'vector' \"x\" foo@
+--
+-- It will substitute each value in the vector for @x@ in the
+-- following Hastache template:
+--
+-- > {{#foo}}
+-- >  {{x}}
+-- > {{/foo}}
 vector :: (Monad m, G.Vector v a, H.MuVar a) =>
-          String -> v a -> MuType m
+          String                -- ^ Name to use when substituting.
+       -> v a
+       -> MuType m
 {-# SPECIALIZE vector :: String -> U.Vector Double -> MuType IO #-}
 vector name v = MuList . map val . G.toList $ v
     where val i = mkStrContext $ \nym ->
                   then MuVariable i
                   else MuNothing
 
+-- | Render the elements of two vectors.
 vector2 :: (Monad m, G.Vector v a, G.Vector v b, H.MuVar a, H.MuVar b) =>
-           String -> String -> v a -> v b -> MuType m
+           String               -- ^ Name for elements from the first vector.
+        -> String               -- ^ Name for elements from the second vector.
+        -> v a                  -- ^ First vector.
+        -> v b                  -- ^ Second vector.
+        -> MuType m
 {-# SPECIALIZE vector2 :: String -> String -> U.Vector Double -> U.Vector Double
                        -> MuType IO #-}
 vector2 name1 name2 v1 v2 = MuList $ zipWith val (G.toList v1) (G.toList v2)
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.