histogram-fill 0.9.0.0 → 0.9.1.0
raw patch · 7 files changed
+95/−15 lines, 7 filesdep ~basePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base
API changes (from Hackage documentation)
- Data.Histogram.Bin.Bin2D: instance (Data.Data.Data binY, Data.Data.Data binX) => Data.Data.Data (Data.Histogram.Bin.Bin2D.Bin2D binX binY)
- Data.Histogram.Bin.Bin2D: instance (GHC.Classes.Eq binY, GHC.Classes.Eq binX) => GHC.Classes.Eq (Data.Histogram.Bin.Bin2D.Bin2D binX binY)
- Data.Histogram.Fill: instance (GHC.Base.Monad m, Data.Semigroup.Semigroup b) => Data.Semigroup.Semigroup (Data.Histogram.Fill.HBuilderM m a b)
- Data.Histogram.Fill: instance Data.Semigroup.Semigroup b => Data.Semigroup.Semigroup (Data.Histogram.Fill.HBuilder a b)
- Data.Histogram.Generic: instance (GHC.Classes.Eq (v a), GHC.Classes.Eq a, GHC.Classes.Eq bin) => GHC.Classes.Eq (Data.Histogram.Generic.Histogram v bin a)
+ Data.Histogram.Bin.Bin2D: instance (Data.Data.Data binX, Data.Data.Data binY) => Data.Data.Data (Data.Histogram.Bin.Bin2D.Bin2D binX binY)
+ Data.Histogram.Bin.Bin2D: instance (GHC.Classes.Eq binX, GHC.Classes.Eq binY) => GHC.Classes.Eq (Data.Histogram.Bin.Bin2D.Bin2D binX binY)
+ Data.Histogram.Fill: instance (GHC.Base.Monad m, GHC.Base.Semigroup b) => GHC.Base.Semigroup (Data.Histogram.Fill.HBuilderM m a b)
+ Data.Histogram.Fill: instance GHC.Base.Semigroup b => GHC.Base.Semigroup (Data.Histogram.Fill.HBuilder a b)
+ Data.Histogram.Generic: instance (GHC.Classes.Eq bin, GHC.Classes.Eq a, GHC.Classes.Eq (v a)) => GHC.Classes.Eq (Data.Histogram.Generic.Histogram v bin a)
- Data.Histogram.Fill: HBuilderM :: (a -> m ()) -> m b -> HBuilderM m a b
+ Data.Histogram.Fill: HBuilderM :: a -> m () -> m b -> HBuilderM m a b
Files
- ChangeLog.md +4/−0
- Data/Histogram.hs +5/−4
- Data/Histogram/Bin.hs +1/−1
- Data/Histogram/Fill.hs +3/−3
- Data/Histogram/Generic.hs +5/−4
- Data/Histogram/Tutorial.hs +71/−0
- histogram-fill.cabal +6/−3
ChangeLog.md view
@@ -1,3 +1,7 @@+Changes in 0.9.1.0+ * Added `Data.Histogram.Tutorial` module + * GHC 8.6 Compatibility+ Changes in 0.9.0.0 * GHC 8.4 compatibility. Semigroup instances added for `HBuilder` and
Data/Histogram.hs view
@@ -9,9 +9,10 @@ -- Stability : experimental -- -- Immutable histograms. This module exports the same API as--- 'Data.Histogram.Generic' but specialized to unboxed vectors. Refer--- to the aforementioned module for documentation.-module Data.Histogram ( -- * Immutable histogram+-- 'Data.Histogram.Generic' but specialized to unboxed vectors. Please refer+-- to the aforementioned module for detailed documentation.+ +module Data.Histogram ( -- * Immutable histograms Histogram , module Data.Histogram.Bin@@ -89,7 +90,7 @@ import Data.Histogram.Generic (HistIndex(..),histIndex) import Data.Histogram.Bin -import Prelude hiding (map,zip,foldl,sum,maximum,minimum)+import Prelude hiding (map, zip, foldl, sum, maximum, minimum)
Data/Histogram/Bin.hs view
@@ -1,6 +1,6 @@ -- Required for Bin2D conversions {-# LANGUAGE MultiParamTypeClasses #-}-{-# LANGUAGE OverlappingInstances #-}+-- {-# LANGUAGE OverlappingInstances #-} -- Yes, I DO want orphans here {-# OPTIONS_GHC -fno-warn-orphans #-} -- |
Data/Histogram/Fill.hs view
@@ -390,8 +390,8 @@ {-# INLINE mkFolder #-} mkFolder a f = HBuilder $ do ref <- newMutVar a- return HBuilderM { hbInput = \a -> do b <- readMutVar ref- writeMutVar ref $! f a b+ return HBuilderM { hbInput = \aa -> do b <- readMutVar ref+ writeMutVar ref $! f aa b , hbOutput = readMutVar ref } @@ -421,7 +421,7 @@ -- | Fill histogram builder. fillBuilderVec :: G.Vector v a => HBuilder a b -> v a -> b {-# INLINE fillBuilderVec #-}-fillBuilderVec hb = \vec ->+fillBuilderVec hb vec = runST $ do h <- toHBuilderST hb G.mapM_ (feedOne h) vec freezeHBuilderM h
Data/Histogram/Generic.hs view
@@ -1,7 +1,8 @@-{-# LANGUAGE CPP #-}-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE DeriveFunctor #-}-{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE CPP #-}+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveFunctor #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE UndecidableInstances #-} -- | -- Module : Data.Histogram -- Copyright : Copyright (c) 2009, Alexey Khudyakov <alexey.skladnoy@gmail.com>
+ Data/Histogram/Tutorial.hs view
@@ -0,0 +1,71 @@+-- |+-- Module : Data.Histogram.Tutorial+-- Copyright : Copyright (c) 2009-2018, Alexey Khudyakov <alexey.skladnoy@gmail.com>+-- License : BSD3+-- Maintainer : Alexey Khudyakov <alexey.skladnoy@gmail.com>+-- Stability : experimental+--+--+-- == 1.+--+-- The first example illustrates one of the most common use-cases of a histogram, i.e.+--+-- * uniformly-spaced, equal-weight bins+--+-- * one-dimensional distribuded data+--+-- * binning range equal to the data range+-- +-- We can write a helper function that populates a 'Histogram' from a+-- 'Foldable' container (e.g. an array, or a 'Vector', or a tree,+-- etc.) of 'Double's :+-- +-- @+-- histo :: ('Foldable' v, 'Unbox' a, Num a) =>+-- Int+-- -> v Double+-- -> 'Histogram' 'BinD' a+-- histo n v = 'fillBuilder' buildr v+-- where+-- mi = minimum v+-- ma = maximum v+-- bins = 'binD' mi n ma+-- buildr = 'mkSimple' bins+-- @+--+-- We can now declare our first histogram with 4 bins and a list of data :+--+-- > > let h0 = histo 4 [1,2,3,5,1,-10,2,3,50,1,6,7,4,6,34,45,20,120,-80]+-- +-- The @Show@ instance of 'Histogram' lets us see the histogram metadata :+--+-- > > h0+-- > # Histogram+-- > # Underflows = 0.0+-- > # Overflows = 1.0+-- > # BinD+-- > # Base = -80.0+-- > # Step = 50.0+-- > # N = 4+-- > -55.0 1.0+-- > -5.0 13.0+-- > 45.0 4.0+-- > 95.0 0.0+--+-- Note : with this binning algorithm, the bin intervals are closed to+-- the left and open to the right, which is why the 120 element is+-- marked as an overlow.+--+-- Note 2 : the output of `show` shouldn't generally be used as a form+-- of data serialization.+--+-- The data bin centers and bin counts can be retrieved with 'asList':+--+-- > > asList h0+-- > [(-55.0,1.0),(-5.0,13.0),(45.0,4.0),(95.0,0.0)]+module Data.Histogram.Tutorial where++import Data.Histogram +import Data.Histogram.Bin+import Data.Histogram.Fill (mkSimple, fillBuilder)+import Data.Vector.Unboxed (Unbox(..))
histogram-fill.cabal view
@@ -1,9 +1,11 @@ Name: histogram-fill-Version: 0.9.0.0+Version: 0.9.1.0 Synopsis: Library for histograms creation. Description:- This is library for histograms filling. Its aim to provide- convenient way to create and fill histograms.+ This is library for histograms filling. Its aim to provide+ convenient way to create and fill histograms.+ .+ To get started, refer to the usage examples in 'Data.Histogram.Tutorial'. Cabal-Version: >= 1.8 License: BSD3@@ -35,6 +37,7 @@ if impl(ghc < 8.0) Build-Depends: semigroups >= 0.18 Exposed-modules:+ Data.Histogram.Tutorial Data.Histogram Data.Histogram.Generic Data.Histogram.Fill