1{-# LANGUAGE ExistentialQuantification #-}
4import qualified Data.List as L
5import Data.ByteString (ByteString(..))
9import Data.Text.Internal (Text(..))
12import Control.Exception
13import Control.Concurrent
17data F a = forall b. F (a -> b) | forall b. Flist (a -> [b])
19class Forceable a where
20 force :: a -> IO Result
21 force v = v `seq` return T
23instance Forceable Text
25seqList = L.foldl' (flip seq) (return ())
26instance Forceable [a] where
27 force = L.foldl' (flip seq) (return T)
29instance Forceable ByteString
30instance Forceable Char
31instance Forceable Bool
33instance Forceable Word8
35instance (Forceable a, Forceable b) => Forceable (a,b) where
36 force (a,b) = force a >> force b
38instance (Forceable a, Forceable b, Forceable c) => Forceable (a,b,c) where
39 force (a,b,c) = force a >> force b >> force c
41run c x tests = sequence_ $ zipWith (runTest c x) [1..] tests
43runTest :: Int -> a -> Int -> (String,[F a]) -> IO ()
44runTest count x n (name,tests) = do
47 printf "\t# %-16s\n" (show name)
49 where fn xs = case xs of
50 [f,g,h] -> runN count f x >> putStr "\t"
51 >> runN count g x >> putStr "\t"
52 >> runN count h x >> putStr "\t"
53 [f,g] -> runN count f x >> putStr "\t"
54 >> runN count g x >> putStr "\t\t"
55 [f] -> runN count f x >> putStr "\t\t\t"
57 run f x = performGC >> threadDelay 100 >> time f x
58 runN 0 f x = return ()
59 runN c f x = run f x >> runN (c-1) f x
65 let diff = (fromIntegral (end - start)) / 10^12
66 printf "%0.3f" (diff :: Double)
73 let diff = (fromIntegral (end - start)) / 10^12
74 printf "%0.3f" (diff :: Double)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list