aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYann Herklotz <git@yannherklotz.com>2020-04-07 15:34:48 +0100
committerYann Herklotz <git@yannherklotz.com>2020-04-07 15:34:48 +0100
commit512e1c24ea03b0b6375451bd13c37b52038f1e6e (patch)
tree7759322cb31f73091fdb5662f53b777dd69d1402
parent4a3f2b3448851fe9ac017ff397f9b9ae2babdce3 (diff)
downloadverismith-512e1c24ea03b0b6375451bd13c37b52038f1e6e.tar.gz
verismith-512e1c24ea03b0b6375451bd13c37b52038f1e6e.zip
Remove statistic dependency
-rw-r--r--src/Verismith/Report.hs12
-rw-r--r--verismith.cabal3
2 files changed, 9 insertions, 6 deletions
diff --git a/src/Verismith/Report.hs b/src/Verismith/Report.hs
index e2707ea..a62dab5 100644
--- a/src/Verismith/Report.hs
+++ b/src/Verismith/Report.hs
@@ -52,11 +52,9 @@ import Data.Text (Text)
import qualified Data.Text as T
import Data.Text.Lazy (toStrict)
import Data.Time
-import Data.Vector (fromList)
import Prelude hiding (FilePath)
import Shelly (FilePath, fromText,
toTextIgnore, (<.>), (</>))
-import Statistics.Sample (meanVariance)
import Text.Blaze.Html (Html, (!))
import Text.Blaze.Html.Renderer.Text (renderHtml)
import qualified Text.Blaze.Html5 as H
@@ -318,13 +316,21 @@ resultStatus :: Result a b -> Html
resultStatus (Pass _) = H.td ! A.class_ "is-success" $ "Passed"
resultStatus (Fail _) = H.td ! A.class_ "is-danger" $ "Failed"
+meanVariance :: [Double] -> (Double, Double)
+meanVariance l = (mean, variance)
+ where
+ mean = sum l / len
+ variance = sum (squ . subtract mean <$> l) / (len - 1.0)
+ squ x = x * x
+ len = fromIntegral $ length l
+
fuzzStats
:: (Real a1, Traversable t)
=> ((a1 -> Const (Endo [a1]) a1) -> a2 -> Const (Endo [a1]) a2)
-> t a2
-> (Double, Double)
fuzzStats sel fr = meanVariance converted
- where converted = fromList . fmap realToFrac $ fr ^.. traverse . sel
+ where converted = fmap realToFrac $ fr ^.. traverse . sel
fuzzStatus :: Text -> FuzzReport -> Html
fuzzStatus name (FuzzReport dir s1 s2 s3 sz t1 t2 t3) = H.tr $ do
diff --git a/verismith.cabal b/verismith.cabal
index f272bac..9754056 100644
--- a/verismith.cabal
+++ b/verismith.cabal
@@ -97,15 +97,12 @@ library
, recursion-schemes >=5.0.2 && <5.2
, shakespeare >=2 && <2.1
, shelly >=1.8.0 && <1.10
- , statistics >=0.14.0.2 && <0.16
, template-haskell >=2.13.0 && <2.16
, text >=1.2 && <1.3
, time >= 1.8.0.2 && <1.10
, tomland >=1.0 && <1.3
, transformers >=0.5 && <0.6
, transformers-base >=0.4.5 && <0.5
- , unordered-containers >=0.2.10 && <0.3
- , vector >=0.12.0.1 && <0.13
default-extensions: OverloadedStrings
executable verismith