Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

Commit

Permalink
Restore compatibility with GHC-7.8
Browse files Browse the repository at this point in the history
  • Loading branch information
sjakobi committed Dec 17, 2017
1 parent 1aa6ba5 commit 5526092
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 8 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Expand Up @@ -31,6 +31,10 @@ matrix:
language: generic
addons: { apt: { packages: [ libgmp-dev ] } }
compiler: ghc-7.10
- env: BUILD=stack RESOLVER=ghc-7.8
language: generic
addons: { apt: { packages: [ libgmp-dev ] } }
compiler: ghc-7.8
- env: BUILD=stack RESOLVER=ghc-8.0
os: osx
language: generic
Expand Down
2 changes: 2 additions & 0 deletions .travis/stack-ghc-7.8.yaml
Expand Up @@ -4,5 +4,7 @@ packages:
extra-deps:
- basement-0.0.2
- foundation-0.0.15
- code-page-0.1.3
- math-functions-0.1.7.0
flags: {}
extra-package-dbs: []
2 changes: 2 additions & 0 deletions Gauge/Analysis.hs
Expand Up @@ -40,6 +40,7 @@ module Gauge.Analysis
-- Temporary: to support pre-AMP GHC 7.8.4:
import Data.Monoid

import Control.Applicative
import Control.Arrow (second)
import Control.DeepSeq (NFData(rnf))
import Control.Monad (forM_, when)
Expand All @@ -55,6 +56,7 @@ import Data.Int (Int64)
import Data.IORef (IORef, readIORef, writeIORef)
import Data.Map (Map)
import Data.Maybe (fromJust, isJust)
import Data.Traversable (traverse)
import GHC.Generics (Generic)
import Statistics.Function (sort)
import Statistics.Quantile (weightedAvg, Sorted(..))
Expand Down
2 changes: 2 additions & 0 deletions Gauge/Main.hs
Expand Up @@ -25,6 +25,7 @@ module Gauge.Main
, benchmarkWith
) where

import Control.Applicative
import Control.Monad (unless, when)
#ifdef HAVE_ANALYSIS
import Gauge.Analysis (analyseBenchmark)
Expand All @@ -35,6 +36,7 @@ import Gauge.Main.Options
import Gauge.Measurement (Measured, measureAccessors_, rescale)
import Gauge.Monad (Gauge, askConfig, withConfig, gaugeIO)
import Data.List (sort)
import Data.Traversable
import System.Environment (getProgName, getArgs)
import System.Exit (ExitCode(..), exitWith)
-- import System.FilePath.Glob
Expand Down
1 change: 1 addition & 0 deletions Gauge/Measurement.hs
Expand Up @@ -42,6 +42,7 @@ module Gauge.Measurement
) where

import Gauge.Time (MicroSeconds(..), microSecondsToDouble, nanoSecondsToDouble)
import Control.Applicative
import Control.DeepSeq (NFData(rnf))
import Control.Monad (when, unless)
import Data.Data (Data, Typeable)
Expand Down
1 change: 1 addition & 0 deletions Gauge/Monad.hs
Expand Up @@ -21,6 +21,7 @@ module Gauge.Monad
, finallyGauge
) where

import Control.Applicative
import Control.Exception
import Control.Monad (ap)
import Data.IORef (IORef, newIORef)
Expand Down
7 changes: 4 additions & 3 deletions Gauge/Source/GC.hs
Expand Up @@ -13,6 +13,7 @@ module Gauge.Source.GC
, withMetrics
) where

import Control.Applicative
import Data.Word
import Data.IORef (readIORef, newIORef, IORef)
import Gauge.Time
Expand All @@ -33,7 +34,7 @@ newtype AbsMetrics = AbsMetrics GHC.GCStats
#endif

-- | Check if RTS/GC metrics gathering is enabled or not
supported :: Bool
supported :: Bool
supported = unsafePerformIO (readIORef supportedVar)
{-# NOINLINE supported #-}

Expand All @@ -46,9 +47,9 @@ supportedVar = unsafePerformIO $ do
#endif
newIORef b
{-# NOINLINE supportedVar #-}

getMetrics :: IO AbsMetrics
getMetrics = AbsMetrics <$>
getMetrics = AbsMetrics <$>
#if MIN_VERSION_base(4,10,0)
GHC.getRTSStats
#else
Expand Down
5 changes: 1 addition & 4 deletions Gauge/Source/RUsage.hsc
Expand Up @@ -25,6 +25,7 @@ module Gauge.Source.RUsage

#ifdef SUPPORT_RUSAGE

import Control.Applicative
import Foreign.C.Error (throwErrnoIfMinus1_)
import Foreign.Storable
import Foreign.Ptr
Expand Down Expand Up @@ -147,10 +148,8 @@ clongToW64 = fromIntegral
sizeRUsage :: Int
sizeRUsage = #const sizeof(struct rusage)

pattern Self :: Who
pattern Self = (#const RUSAGE_SELF)

pattern Children :: Who
pattern Children = (#const RUSAGE_CHILDREN)

type Who = CInt
Expand Down Expand Up @@ -180,10 +179,8 @@ supported = True

#else

pattern Self :: Who
pattern Self = 1

pattern Children :: Who
pattern Children = 2

type Who = CInt
Expand Down
1 change: 1 addition & 0 deletions Gauge/Source/Time.hsc
Expand Up @@ -25,6 +25,7 @@ module Gauge.Source.Time

#include "gauge-time.h"

import Control.Applicative
import Data.Word (Word64)
import Foreign.Ptr
import Foreign.Storable
Expand Down
1 change: 1 addition & 0 deletions benchs/Main.hs
Expand Up @@ -3,6 +3,7 @@ module Main where

import Gauge
import System.IO.Unsafe
import Control.Applicative
import Control.Concurrent
import Control.Exception

Expand Down
2 changes: 1 addition & 1 deletion gauge.cabal
Expand Up @@ -103,7 +103,7 @@ library
-- formely statistics dependency that we need
if flag(analysis)
build-depends:
math-functions
math-functions >= 0.1.7

default-language: Haskell2010
ghc-options: -O2 -Wall -funbox-strict-fields
Expand Down
1 change: 1 addition & 0 deletions statistics/Statistics/Function.hs
Expand Up @@ -39,6 +39,7 @@ module Statistics.Function

#include "MachDeps.h"

import Control.Applicative
import Control.Monad.ST (ST)
import Data.Bits ((.|.), shiftR)
import qualified Data.Vector.Generic as G
Expand Down

0 comments on commit 5526092

Please sign in to comment.