approx-rand-test 0.2.0 → 0.2.1
raw patch · 3 files changed
+34/−28 lines, 3 filesdep +data-defaultdep ~Chartdep ~Chart-cairodep ~Chart-diagrams
Dependencies added: data-default
Dependency ranges changed: Chart, Chart-cairo, Chart-diagrams
Files
- approx-rand-test.cabal +13/−13
- utils/ChartHistogram.hs +6/−7
- utils/diagrams/ChartBackend.hs +15/−8
approx-rand-test.cabal view
@@ -1,5 +1,5 @@ Name: approx-rand-test-Version: 0.2.0+Version: 0.2.1 License: OtherLicense License-file: LICENSE Copyright: Copyright 2012-2013 Daniël de Kok@@ -54,20 +54,20 @@ HS-Source-Dirs: utils Ghc-Options: -O2 -Wall Build-Depends: base >= 4 && < 5, approx-rand-test,- Chart == 1.0, colour == 2.3.*, conduit >= 0.4 && < 1.1,- containers >= 0.4 && < 0.6, data-default-class == 0.0.*,- filepath >= 1.3 && < 1.5, lens == 3.9.*,- mersenne-random-pure64 == 0.2.0.*,+ Chart == 1.1, colour == 2.3.*, conduit >= 0.4 && < 1.1,+ containers >= 0.4 && < 0.6, data-default == 0.5.*,+ data-default-class == 0.0.*, filepath >= 1.3 && < 1.5,+ lens == 3.9.*, mersenne-random-pure64 == 0.2.0.*, monad-mersenne-random == 0.1, mtl >= 2.0.1 && < 2.2, text >= 0.11.1 && < 0.11.4, vector >= 0.9 && < 0.11, statistics == 0.10.*, vector-algorithms == 0.5.* if flag(withCairo) Hs-Source-Dirs: utils/cairo- Build-Depends: Chart-cairo == 1.0+ Build-Depends: Chart-cairo == 1.1 else Hs-Source-Dirs: utils/diagrams- Build-Depends: Chart-diagrams == 1.0+ Build-Depends: Chart-diagrams == 1.1 Executable approx_rand_test_paired@@ -77,20 +77,20 @@ HS-Source-Dirs: utils Ghc-Options: -O2 -Wall Build-Depends: base >= 4 && < 5, approx-rand-test,- Chart == 1.0, colour == 2.3.*, conduit >= 0.4 && < 1.1,- containers >= 0.4 && < 0.6, data-default-class == 0.0.*,- filepath >= 1.3 && < 1.5, lens == 3.9.*,- mersenne-random-pure64 == 0.2.0.*,+ Chart == 1.1, colour == 2.3.*, conduit >= 0.4 && < 1.1,+ containers >= 0.4 && < 0.6, data-default == 0.5.*,+ data-default-class == 0.0.*, filepath >= 1.3 && < 1.5,+ lens == 3.9.*, mersenne-random-pure64 == 0.2.0.*, monad-mersenne-random == 0.1, mtl >= 2.0.1 && < 2.2, text >= 0.11.1 && < 0.11.4, vector >= 0.9 && < 0.11, statistics == 0.10.*, vector-algorithms == 0.5.* if flag(withCairo) Hs-Source-Dirs: utils/cairo- Build-Depends: Chart-cairo == 1.0+ Build-Depends: Chart-cairo == 1.1 else Hs-Source-Dirs: utils/diagrams- Build-Depends: Chart-diagrams == 1.0+ Build-Depends: Chart-diagrams == 1.1 Test-Suite tests Type: exitcode-stdio-1.0
utils/ChartHistogram.hs view
@@ -36,13 +36,12 @@ Chart.toRenderable layout where layout =- Chart.layout1_background .~ Chart.solidFillStyle opaqueWhite- $ Chart.layout1_left_axis . Chart.laxis_override .~ Chart.axisTicksHide- $ Chart.layout1_right_axis . Chart.laxis_title .~ "Frequency"- $ Chart.layout1_bottom_axis . Chart.laxis_title .~ "Statistic"- $ Chart.layout1_plots .~ [ Right (Chart.plotBars randomizationBars),- Right statisticLine, Right sigLines ]- $ Chart.setLayout1Foreground opaqueBlack+ Chart.layout_background .~ Chart.solidFillStyle opaqueWhite+ $ Chart.layout_y_axis . Chart.laxis_title .~ "Frequency"+ $ Chart.layout_x_axis . Chart.laxis_title .~ "Statistic"+ $ Chart.layout_plots .~ [ Chart.plotBars randomizationBars,+ statisticLine, sigLines ]+ $ Chart.setLayoutForeground opaqueBlack $ def randomizationBars = Chart.plot_bars_style .~ Chart.BarsStacked
utils/diagrams/ChartBackend.hs view
@@ -1,30 +1,37 @@+{-# OPTIONS_GHC -fno-warn-orphans #-}+ module ChartBackend ( backendFormats, writeWithBackend ) where +import Control.Lens.Setter ((.~)) import Control.Monad (void)+import Data.Default+import Data.Default.Class () import qualified Graphics.Rendering.Chart as Chart import qualified Graphics.Rendering.Chart.Backend.Diagrams as DiagramsChart import qualified System.FilePath.Posix as FP import System.IO (hPutStrLn, stderr) -backendFormats :: [String]-backendFormats = ["eps", "svg"]+type RenderFunction a = Chart.Renderable a -> FilePath -> IO (Chart.PickFn a) -type RenderFunction a = Chart.Renderable a -> Double -> Double -> FilePath ->- IO (Chart.PickFn a)+instance Default DiagramsChart.FileOptions where+ def = DiagramsChart.FileOptions (800, 600) DiagramsChart.SVG def renderFunctions :: [(String, RenderFunction a)] renderFunctions =- [ (".eps", DiagramsChart.renderableToEPSFile),- (".svg", DiagramsChart.renderableToSVGFile) ]- + [ (".eps", DiagramsChart.renderableToFile $+ DiagramsChart.fo_format .~ DiagramsChart.EPS $ def),+ (".svg", DiagramsChart.renderableToFile def) ] +backendFormats :: [String]+backendFormats = map fst renderFunctions+ writeWithBackend :: Chart.Renderable () -> FP.FilePath -> IO () writeWithBackend renderable path = case lookup (snd $ FP.splitExtension path) renderFunctions of- Just f -> void $ f renderable 800 600 path+ Just f -> void $ f renderable path Nothing -> hPutStrLn stderr "Unknown output format!"