histogram-fill-cereal (empty) → 0.6.0.0
raw patch · 4 files changed
+132/−0 lines, 4 filesdep +basedep +cerealdep +histogram-fillsetup-changed
Dependencies added: base, cereal, histogram-fill, vector
Files
- Data/Histogram/Cereal.hs +70/−0
- LICENSE +30/−0
- Setup.hs +2/−0
- histogram-fill-cereal.cabal +30/−0
+ Data/Histogram/Cereal.hs view
@@ -0,0 +1,70 @@+{-# OPTIONS_GHC -fno-warn-orphans #-}+-- | Cereal instances for histogram-fill+module Data.Histogram.Cereal (+ ) where++import Control.Applicative+-- import Control.Monad+import Data.Serialize+import qualified Data.Vector.Generic as G++import Data.Histogram.Bin+import Data.Histogram.Generic (Histogram, histogramUO, histData, outOfRange, bins)++++----------------------------------------------------------------+-- Bins+----------------------------------------------------------------++instance Serialize BinI where+ get = binI <$> get <*> get+ put b = do put (lowerLimit b)+ put (upperLimit b)++instance Serialize BinInt where+ get = binIntStep <$> get <*> get <*> get+ put b = do put (lowerLimit b)+ put (binSize b)+ put (nBins b)++instance (RealFrac f, Serialize f) => Serialize (BinF f) where+ get = binFstep <$> get <*> get <*> get+ put b = do put (lowerLimit b)+ put (binSize b)+ put (nBins b)++instance Serialize BinD where+ get = binDstep <$> get <*> get <*> get+ put b = do put (lowerLimit b)+ put (binSize b)+ put (nBins b)++instance Serialize LogBinD where+ get = logBinDN <$> get <*> get <*> get+ put b = do put (lowerLimit b)+ put (logBinDIncrement b)+ put (nBins b)++instance Serialize (BinEnum a) where+ get = BinEnum <$> get+ put (BinEnum b) = put b++instance (Serialize bX, Serialize bY) => Serialize (Bin2D bX bY) where+ get = Bin2D <$> get <*> get+ put (Bin2D bx by) = put bx >> put by+++----------------------------------------------------------------+-- Histogram+----------------------------------------------------------------++instance (Serialize a, G.Vector v a, Bin bin, Serialize bin+ ) => Serialize (Histogram v bin a) where+ get = do b <- get+ uo <- get+ v <- G.replicateM (nBins b) get+ return $! histogramUO b uo v+ put h = do put (bins h)+ put (outOfRange h)+ G.mapM_ put (histData h)
+ LICENSE view
@@ -0,0 +1,30 @@+Copyright (c)2009-2012, Aleksey Khudyakov++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of asd nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ histogram-fill-cereal.cabal view
@@ -0,0 +1,30 @@+Name: histogram-fill-cereal+Version: 0.6.0.0+Synopsis: Library for histograms creation.+Description:+ Cereal instances for histogram-fill package++Cabal-Version: >= 1.6+License: BSD3+License-File: LICENSE+Author: Alexey Khudyakov+Maintainer: Alexey Khudyakov <alexey.skladnoy@gmail.com>+Homepage: http://bitbucket.org/Shimuuar/histogram-fill-cereal/+Category: Data+Build-Type: Simple++source-repository head+ type: hg+ location: http://bitbucket.org/Shimuuar/histogram-fill-cereal+source-repository head+ type: git+ location: http://github.com/Shimuuar/histogram-fill-cereal++Library+ Build-Depends: base >=3 && <5,+ cereal,+ vector >= 0.7,+ histogram-fill >= 0.6+ Exposed-modules: Data.Histogram.Cereal+ Ghc-options: -Wall+ Ghc-prof-options: -auto-all