File: Benchmark.hs

package info (click to toggle)
haskell-shake 0.13.2%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 888 kB
  • ctags: 127
  • sloc: haskell: 6,388; makefile: 35; ansic: 25; sh: 2
file content (21 lines) | stat: -rw-r--r-- 735 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

module Examples.Test.Benchmark(main) where

import Development.Shake
import Examples.Util
import Data.List
import Development.Shake.FilePath


-- | Given a breadth and depth come up with a set of build files
main = shaken (\_ _ -> return ()) $ \args obj -> do
    let get ty = head $ [read $ drop (length ty + 1) a | a <- args, (ty ++ "=") `isPrefixOf` a] ++
                        error ("Could not find argument, expected " ++ ty ++ "=Number")
        depth = get "depth"
        breadth = get "breadth"

    want [obj $ "0." ++ show i | i <- [1..breadth]]
    obj "*" *> \out -> do
        let d = read $ takeBaseName out
        need [obj $ show (d + 1) ++ "." ++ show i | d < depth, i <- [1..breadth]]
        writeFile' out ""