Commits

Aleksey Khudyakov committed 8e4f75f

Move Count to Numeric

  • Participants
  • Parent commits 82c7ab5

Comments (0)

Files changed (2)

File Data/Monoid/Statistics.hs

 module Data.Monoid.Statistics ( StatMonoid(..)
                               , evalStatistic
                                 -- * Statistic monoids
-                              , Count(..)
                               , TwoStats(..)
                                 -- * Additional information
                                 -- $info
 --   foldl'.
 evalStatistic :: (F.Foldable d, StatMonoid m a) => d a -> m
 evalStatistic = F.foldl' (flip pappend) mempty
-
-
-
-----------------------------------------------------------------
--- Simple monoids
-----------------------------------------------------------------
-
--- | Simplest statistics. Number of elements in the sample
-newtype Count a = Count { calcCount :: a }
-                  deriving Show
-
-instance Integral a => Monoid (Count a) where
-  mempty = Count 0
-  (Count i) `mappend` (Count j) = Count (i + j)
-  {-# INLINE mempty  #-}
-  {-# INLINE mappend #-}
   
-instance (Integral a) => StatMonoid (Count a) b where
-  pappend _ !(Count n) = Count (n + 1)
-  {-# INLINE pappend #-}
-  
-  
-  
-
 
 ----------------------------------------------------------------
 -- Generic monoids

File Data/Monoid/Statistics/Numeric.hs

 -- Statistical monoids
 ----------------------------------------------------------------
 
+-- | Simplest statistics. Number of elements in the sample
+newtype Count a = Count { calcCount :: a }
+                  deriving Show
+
+instance Integral a => Monoid (Count a) where
+  mempty = Count 0
+  (Count i) `mappend` (Count j) = Count (i + j)
+  {-# INLINE mempty  #-}
+  {-# INLINE mappend #-}
+  
+instance (Integral a) => StatMonoid (Count a) b where
+  pappend _ !(Count n) = Count (n + 1)
+  {-# INLINE pappend #-}
+
+
 -- | Mean of sample. Samples of Double,Float and bui;t-in integral
 --   types are supported
 --