Bryan O'Sullivan avatar Bryan O'Sullivan committed ce4e732

Add GHC generics support everywhere

Comments (0)

Files changed (6)

Criterion/Analysis/Types.hs

-{-# LANGUAGE DeriveDataTypeable, OverloadedStrings, RecordWildCards #-}
+{-# LANGUAGE DeriveDataTypeable, DeriveGeneric, OverloadedStrings,
+    RecordWildCards #-}
 -- |
 -- Module      : Criterion.Analysis.Types
 -- Copyright   : (c) 2011 Bryan O'Sullivan
     ) where
 
 import Control.DeepSeq (NFData(rnf))
-import Data.Data (Data)
+import Data.Data (Data, Typeable)
 import Data.Int (Int64)
 import Data.Monoid (Monoid(..))
-import Data.Typeable (Typeable)
+import GHC.Generics (Generic)
 import qualified Statistics.Resampling.Bootstrap as B
 
 -- | Outliers from sample data, calculated using the boxplot
     -- ^ Between 1.5 and 3 times the IQR above the third quartile.
     , highSevere  :: {-# UNPACK #-} !Int64
     -- ^ More than 3 times the IQR above the third quartile.
-    } deriving (Eq, Read, Show, Typeable, Data)
+    } deriving (Eq, Read, Show, Typeable, Data, Generic)
 
 instance NFData Outliers
 
                    | Moderate   -- ^ Between 10% and 50%.
                    | Severe     -- ^ Above 50% (i.e. measurements
                                 -- are useless).
-                     deriving (Eq, Ord, Read, Show, Typeable, Data)
+                     deriving (Eq, Ord, Read, Show, Typeable, Data, Generic)
 
 instance NFData OutlierEffect
 
     -- ^ Brief textual description of effect.
     , ovFraction :: Double
     -- ^ Quantitative description of effect (a fraction between 0 and 1).
-    } deriving (Eq, Read, Show, Typeable, Data)
+    } deriving (Eq, Read, Show, Typeable, Data, Generic)
 
 instance NFData OutlierVariance where
     rnf OutlierVariance{..} = rnf ovEffect `seq` rnf ovDesc `seq` rnf ovFraction
       anMean :: B.Estimate
     , anStdDev :: B.Estimate
     , anOutlierVar :: OutlierVariance
-    } deriving (Eq, Show, Typeable, Data)
+    } deriving (Eq, Read, Show, Typeable, Data, Generic)
 
 instance NFData SampleAnalysis where
     rnf SampleAnalysis{..} =

Criterion/Config.hs

-{-# LANGUAGE DeriveDataTypeable #-}
+{-# LANGUAGE DeriveDataTypeable, DeriveGeneric #-}
 
 -- |
 -- Module      : Criterion.Config
     , ljust
     ) where
 
-import Data.Data (Data)
+import Data.Data (Data, Typeable)
 import Data.Function (on)
 import Data.Monoid (Monoid(..), Last(..))
-import Data.Typeable (Typeable)
+import GHC.Generics (Generic)
 
 data MatchType = Prefix | Glob
-               deriving (Eq, Ord, Bounded, Enum, Read, Show, Typeable)
+               deriving (Eq, Ord, Bounded, Enum, Read, Show, Typeable, Data,
+                         Generic)
 
 -- | Control the amount of information displayed.
 data Verbosity = Quiet
                | Normal
                | Verbose
-                 deriving (Eq, Ord, Bounded, Enum, Read, Show, Typeable)
+                 deriving (Eq, Ord, Bounded, Enum, Read, Show, Typeable, Data,
+                           Generic)
 
 -- | Print some information and exit, without running any benchmarks.
 data PrintExit = Nada           -- ^ Do not actually print-and-exit. (Default.)
                | List           -- ^ Print a list of known benchmarks.
                | Version        -- ^ Print version information (if known).
                | Help           -- ^ Print a help\/usaage message.
-                 deriving (Eq, Ord, Bounded, Enum, Read, Show, Typeable, Data)
+                 deriving (Eq, Ord, Bounded, Enum, Read, Show, Typeable, Data,
+                           Generic)
 
 instance Monoid PrintExit where
     mempty  = Nada
     , cfgVerbosity    :: Last Verbosity -- ^ Whether to run verbosely.
     , cfgJUnitFile    :: Last FilePath -- ^ Filename of JUnit report.
     , cfgMeasure      :: Last Bool   -- ^ Whether to do any measurement.
-    } deriving (Eq, Read, Show, Typeable)
+    } deriving (Eq, Read, Show, Typeable, Generic)
 
 instance Monoid Config where
     mempty  = emptyConfig

Criterion/Environment.hs

-{-# LANGUAGE DeriveDataTypeable, TypeOperators #-}
+{-# LANGUAGE DeriveDataTypeable, DeriveGeneric, TypeOperators #-}
 
 -- |
 -- Module      : Criterion.Environment
 import Criterion.Measurement (getTime, runForAtLeast, time_)
 import Criterion.Monad (Criterion)
 import qualified Data.Vector.Unboxed as U
-import Data.Typeable (Typeable)
+import Data.Data (Data, Typeable)
+import GHC.Generics (Generic)
 
 -- | Measured aspects of the execution environment.
 data Environment = Environment {
     -- ^ Clock resolution (in seconds).
     , envClockCost       :: {-# UNPACK #-} !Double
     -- ^ The cost of a single clock call (in seconds).
-    } deriving (Eq, Read, Show, Typeable)
+    } deriving (Eq, Read, Show, Typeable, Data, Generic)
 
 -- | Measure the execution environment.
 measureEnvironment :: Criterion Environment

Criterion/Internal.hs

-{-# LANGUAGE RecordWildCards #-}
+{-# LANGUAGE DeriveDataTypeable, DeriveGeneric, RecordWildCards #-}
 -- |
 -- Module      : Criterion
 -- Copyright   : (c) 2009, 2010, 2011 Bryan O'Sullivan
 
 import Control.Monad (replicateM_, when, mplus)
 import Control.Monad.Trans (liftIO)
+import Data.Data (Data, Typeable)
 import Criterion.Analysis (Outliers(..), OutlierEffect(..), OutlierVariance(..),
                            SampleAnalysis(..), analyseSample,
                            classifyOutliers, noteOutliers)
                         bench, bgroup, nf, nfIO, whnf, whnfIO)
 import qualified Data.Vector.Unboxed as U
 import Data.Monoid (getLast)
+import GHC.Generics (Generic)
 import Statistics.Resampling.Bootstrap (Estimate(..))
 import Statistics.Types (Sample)
 import System.Mem (performGC)
                      , sampleAnalysis :: SampleAnalysis
                      , _outliers      :: Outliers
                      }
+            deriving (Eq, Read, Show, Typeable, Data, Generic)
 
 type ResultForest = [ResultTree]
 data ResultTree = Single Result | Compare ResultForest
+                deriving (Eq, Read, Show, Typeable, Data, Generic)
 
 -- | Run, and analyse, one or more benchmarks.
 runAndAnalyse :: (String -> Bool) -- ^ A predicate that chooses

Criterion/Report.hs

-{-# LANGUAGE DeriveDataTypeable, OverloadedStrings, RecordWildCards,
-    ScopedTypeVariables #-}
+{-# LANGUAGE DeriveDataTypeable, DeriveGeneric, OverloadedStrings,
+    RecordWildCards, ScopedTypeVariables #-}
 
 -- |
 -- Module      : Criterion.Report
 import Criterion.Monad (Criterion, getConfig)
 import Data.Data (Data, Typeable)
 import Data.Monoid (Last(..))
+import GHC.Generics (Generic)
 import Paths_criterion (getDataFileName)
 import Statistics.Sample.KernelDensity (kde)
 import Statistics.Types (Sample)
     , reportTimes :: Sample
     , reportAnalysis :: SampleAnalysis
     , reportOutliers :: Outliers
-    } deriving (Eq, Show, Typeable, Data)
+    } deriving (Eq, Read, Show, Typeable, Data, Generic)
 
 -- | The path to the template and other files used for generating
 -- reports.
 -- | A problem arose with a template.
 data TemplateException =
     TemplateNotFound FilePath   -- ^ The template could not be found.
-    deriving (Eq, Show, Typeable, Data)
+    deriving (Eq, Read, Show, Typeable, Data, Generic)
 
 instance Exception TemplateException
 
 name:           criterion
-version:        0.7.0.0
+version:        0.7.1.0
 synopsis:       Robust, reliable performance measurement and analysis
 license:        BSD3
 license-file:   LICENSE
     mtl >= 2,
     mwc-random >= 0.8.0.3,
     parsec >= 3.1.0,
-    statistics >= 0.10.0.0,
+    statistics >= 0.10.4.0,
     time,
     transformers,
     vector >= 0.7.1,
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.