Commits

Aleksey Khudyakov  committed 8f6f5b0 Merge

merge repos

  • Participants
  • Parent commits 64526a5, 4ef3cba

Comments (0)

Files changed (5)

 f15ff79c817971c82719aff4b64fffd8488c99ec histogram-fill-v0.1
 17b9628efd9928e8ecf3ac41af396554a3e111b4 histogram-fill-v0.2
+0ac6f2417e09b94c6ca48640214b1a25ace0ac15 histogram-fill-cereal-v0.6.0.0
+055c97c2c2ead7413df95ba572e208939c7b4ce3 histogram-fill-cereal-v0.6.2.0
 b6333b58124046720e146202c481f0aa323cf35a histogram-fill-v0.2.1
 abe414e250cbe84d7b518a96683332a3289e9ce5 0.3
 abe414e250cbe84d7b518a96683332a3289e9ce5 0.3

File histogram-fill-cereal/Data/Histogram/Cereal.hs

+{-# OPTIONS_GHC -fno-warn-orphans       #-}
+{-# LANGUAGE StandaloneDeriving         #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+-- | 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.Bin.MaybeBin
+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
+
+deriving instance (Serialize bin) => Serialize (MaybeBin bin)
+
+
+
+----------------------------------------------------------------
+-- 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)

File histogram-fill-cereal/LICENSE

+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.

File histogram-fill-cereal/Setup.hs

+import Distribution.Simple
+main = defaultMain

File histogram-fill-cereal/histogram-fill-cereal.cabal

+Name:           histogram-fill-cereal
+Version:        0.6.2.0
+Synopsis:       Library for histograms creation.
+Description:
+  Cereal instances for histogram-fill package
+  .
+  Changes in 0.6.2.0
+  .
+  * Instance for 'MaybeBin' added
+
+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