histogram-fill 0.8.2.0 → 0.8.3.0
raw patch · 4 files changed
+20/−11 lines, 4 files
Files
- ChangeLog +6/−0
- Data/Histogram/Bin/Classes.hs +4/−1
- Data/Histogram/Fill.hs +9/−9
- histogram-fill.cabal +1/−1
ChangeLog view
@@ -1,3 +1,9 @@+Changes in 0.8.3.0++ * Constraints are relaxed from `PrimMonad' to `Monad' wherever possible in+ Data.Histogram.Fill module.++ Changes in 0.8.2.0 * Smart constructors for BinF and BinD check that bin number is not
Data/Histogram/Bin/Classes.hs view
@@ -108,7 +108,10 @@ unsafeSliceBin :: Int -> Int -> b -> b -- | Slice bin using indices-sliceBin :: SliceableBin b => Int -> Int -> b -> b+sliceBin :: SliceableBin b+ => Int -- ^ Index of first bin+ -> Int -- ^ Index of last bin+ -> b -> b sliceBin i j b | i < 0 || j < 0 || i > j || i >= n || j >= n = error "sliceBin: bad slice" | otherwise = unsafeSliceBin i j b
Data/Histogram/Fill.hs view
@@ -214,15 +214,15 @@ } -- | Builders modified using 'HistBuilder' API will share same buffer.-instance PrimMonad m => HistBuilder (HBuilderM m) where+instance Monad m => HistBuilder (HBuilderM m) where modifyIn f h = h { hbInput = hbInput h . f } addCut f h = h { hbInput = \x -> when (f x) (hbInput h x) } fromContainer fmapM_ h = h { hbInput = fmapM_ (hbInput h) } modifyOut f h = h { hbOutput = f `liftM` hbOutput h } -instance PrimMonad m => Functor (HBuilderM m a) where+instance Monad m => Functor (HBuilderM m a) where fmap = modifyOut-instance PrimMonad m => Applicative (HBuilderM m a) where+instance Monad m => Applicative (HBuilderM m a) where pure x = HBuilderM { hbInput = const $ return () , hbOutput = return x }@@ -232,7 +232,7 @@ return (a b) } -instance (PrimMonad m, Monoid b) => Monoid (HBuilderM m a b) where+instance (Monad m, Monoid b) => Monoid (HBuilderM m a b) where mempty = HBuilderM { hbInput = \_ -> return () , hbOutput = return mempty }@@ -243,13 +243,13 @@ -- | Put one item into histogram-feedOne :: PrimMonad m => HBuilderM m a b -> a -> m ()+feedOne :: Monad m => HBuilderM m a b -> a -> m () feedOne = hbInput {-# INLINE feedOne #-} -- | Extract result from histogram builder. It's safe to call this -- function multiple times and mutate builder afterwards.-freezeHBuilderM :: PrimMonad m => HBuilderM m a b -> m b+freezeHBuilderM :: Monad m => HBuilderM m a b -> m b freezeHBuilderM = hbOutput {-# INLINE freezeHBuilderM #-} @@ -389,7 +389,7 @@ -- | Create stateful histogram builder. Output function should be safe -- to call multiple times and builder could be modified afterwards. -- So functions like @unsafeFreeze@ from @vector@ couldn't be used.-mkStatefulBuilder :: PrimMonad m+mkStatefulBuilder :: Monad m => (a -> m ()) -- ^ Add value to accumulator -> m b -- ^ Extract result from accumulator -> HBuilderM m a b@@ -448,13 +448,13 @@ ---------------------------------------------------------------- -- | Join histogram builders in container-joinHBuilderM :: (F.Traversable f, PrimMonad m) => f (HBuilderM m a b) -> HBuilderM m a (f b)+joinHBuilderM :: (F.Traversable f, Monad m) => f (HBuilderM m a b) -> HBuilderM m a (f b) joinHBuilderM = F.sequenceA {-# INLINE joinHBuilderM #-} {-# DEPRECATED joinHBuilderM "Use Data.Traversable.sequenceA instead" #-} -- | Apply functions to builder-treeHBuilderM :: (PrimMonad m, F.Traversable f) => f (HBuilderM m a b -> HBuilderM m a' b') -> HBuilderM m a b -> HBuilderM m a' (f b')+treeHBuilderM :: (Monad m, F.Traversable f) => f (HBuilderM m a b -> HBuilderM m a' b') -> HBuilderM m a b -> HBuilderM m a' (f b') treeHBuilderM fs h = F.traverse ($ h) fs {-# INLINE treeHBuilderM #-} {-# DEPRECATED treeHBuilderM
histogram-fill.cabal view
@@ -1,5 +1,5 @@ Name: histogram-fill-Version: 0.8.2.0+Version: 0.8.3.0 Synopsis: Library for histograms creation. Description: This is library for histograms filling. Its aim to provide