Created
July 16, 2015 00:12
-
-
Save JoeyEremondi/a7dc54e2f6bad269f3c3 to your computer and use it in GitHub Desktop.
Elm Benchmark API prototype
This file contains hidden or 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
module Benchmark | |
( Benchmark | |
, Suite | |
, run | |
, bench1 | |
, bench2 | |
, bench3 | |
, bench4 | |
, bench5 | |
, bench6 | |
, bench7 | |
, bench8 | |
, bench9 | |
)where | |
import Task | |
import String | |
type Never = | |
Never Never | |
type Benchmark = | |
Benchmark | |
type Suite = | |
SingleBenchmark Benchmark | |
| Suite String (List Benchmark) | |
--Private function, helps us avoid currying | |
makeBenchmark : String -> ( () -> result) -> Benchmark | |
makeBenchmark name thunk = | |
Native.makeBenchmark (name, thunk) | |
run : Suite -> Task.Task Never String | |
run = Native.runBenchmark | |
bench1 : String -> (a -> result) -> a -> Benchmark | |
bench1 name f a = | |
makeBenchmark name (\_ -> f a) | |
bench2 : String -> (a -> b -> result) -> a -> b -> Benchmark | |
bench2 name f a b = | |
makeBenchmark name (\_ -> f a b) | |
bench3 : String -> (a -> b -> c -> result) -> a -> b -> c -> Benchmark | |
bench3 name f a b c = | |
makeBenchmark name (\_ -> f a b c) | |
bench4 : String -> (a -> b -> c -> d -> result) -> a -> b -> c -> d -> Benchmark | |
bench4 name f a b c d = | |
makeBenchmark name (\_ -> f a b c d) | |
bench5 : String -> (a -> b -> c -> d -> e -> result) -> a -> b -> c -> d -> e -> Benchmark | |
bench5 name f a b c d e = | |
makeBenchmark name (\_ -> f a b c d e) | |
bench6 : | |
String | |
-> (a -> b -> c -> d -> e -> f -> result) | |
-> a | |
-> b | |
-> c | |
-> d | |
-> e | |
-> f | |
-> Benchmark | |
bench6 name fn a b c d e f = | |
makeBenchmark name (\_ -> fn a b c d e f) | |
bench7 : | |
String | |
-> (a -> b -> c -> d -> e -> f -> g -> result) | |
-> a | |
-> b | |
-> c | |
-> d | |
-> e | |
-> f | |
-> g | |
-> Benchmark | |
bench7 name fn a b c d e f g = | |
makeBenchmark name (\_ -> fn a b c d e f g) | |
bench8 : | |
String | |
-> (a -> b -> c -> d -> e -> f -> g -> h -> result) | |
-> a | |
-> b | |
-> c | |
-> d | |
-> e | |
-> f | |
-> g | |
-> h | |
-> Benchmark | |
bench8 name fn a b c d e f g h = | |
makeBenchmark name (\_ -> fn a b c d e f g h) | |
bench9 : | |
String | |
-> (a -> b -> c -> d -> e -> f -> g -> h -> i -> result) | |
-> a | |
-> b | |
-> c | |
-> d | |
-> e | |
-> f | |
-> g | |
-> h | |
-> i | |
-> Benchmark | |
bench9 name fn a b c d e f g h i = | |
makeBenchmark name (\_ -> fn a b c d e f g h i) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment