packages feed

approximate 0.2.2.3 → 0.3

raw patch · 9 files changed

+167/−149 lines, 9 filesdep −hashable-extrasdep ~binarydep ~comonaddep ~hashablesetup-changednew-uploaderPVP ok

version bump matches the API change (PVP)

Dependencies removed: hashable-extras

Dependency ranges changed: binary, comonad, hashable, pointed, vector

API changes (from Hackage documentation)

- Data.Approximate.Mass: instance Data.Hashable.Extras.Hashable1 Data.Approximate.Mass.Mass
- Data.Approximate.Mass: instance GHC.Generics.Constructor Data.Approximate.Mass.C1_0Mass
- Data.Approximate.Mass: instance GHC.Generics.Datatype Data.Approximate.Mass.D1Mass
- Data.Approximate.Type: instance Data.Hashable.Extras.Hashable1 Data.Approximate.Type.Approximate
- Data.Approximate.Type: instance GHC.Generics.Constructor Data.Approximate.Type.C1_0Approximate
- Data.Approximate.Type: instance GHC.Generics.Datatype Data.Approximate.Type.D1Approximate
- Data.Approximate.Type: instance GHC.Generics.Selector Data.Approximate.Type.S1_0_0Approximate
- Data.Approximate.Type: instance GHC.Generics.Selector Data.Approximate.Type.S1_0_1Approximate
- Data.Approximate.Type: instance GHC.Generics.Selector Data.Approximate.Type.S1_0_2Approximate
- Data.Approximate.Type: instance GHC.Generics.Selector Data.Approximate.Type.S1_0_3Approximate
+ Data.Approximate.Mass: infixl 6 ^?
+ Data.Approximate.Mass: infixr 2 |?
+ Data.Approximate.Mass: infixr 3 &?
+ Data.Approximate.Mass: instance Data.Hashable.Class.Hashable1 Data.Approximate.Mass.Mass
+ Data.Approximate.Type: instance Data.Hashable.Class.Hashable1 Data.Approximate.Type.Approximate
- Data.Approximate.Type: approximate :: HasApproximate c_aj1A a_afRM => Lens' c_aj1A (Approximate a_afRM)
+ Data.Approximate.Type: approximate :: HasApproximate c_aq5z a_alY7 => Lens' c_aq5z (Approximate a_alY7)
- Data.Approximate.Type: class HasApproximate c_aj1A a_afRM | c_aj1A -> a_afRM where confidence = (.) approximate confidence estimate = (.) approximate estimate hi = (.) approximate hi lo = (.) approximate lo
+ Data.Approximate.Type: class HasApproximate c_aq5z a_alY7 | c_aq5z -> a_alY7 where confidence = (.) approximate confidence estimate = (.) approximate estimate hi = (.) approximate hi lo = (.) approximate lo
- Data.Approximate.Type: confidence :: HasApproximate c_aj1A a_afRM => Lens' c_aj1A (Log Double)
+ Data.Approximate.Type: confidence :: HasApproximate c_aq5z a_alY7 => Lens' c_aq5z (Log Double)
- Data.Approximate.Type: estimate :: HasApproximate c_aj1A a_afRM => Lens' c_aj1A a_afRM
+ Data.Approximate.Type: estimate :: HasApproximate c_aq5z a_alY7 => Lens' c_aq5z a_alY7
- Data.Approximate.Type: hi :: HasApproximate c_aj1A a_afRM => Lens' c_aj1A a_afRM
+ Data.Approximate.Type: hi :: HasApproximate c_aq5z a_alY7 => Lens' c_aq5z a_alY7
- Data.Approximate.Type: lo :: HasApproximate c_aj1A a_afRM => Lens' c_aj1A a_afRM
+ Data.Approximate.Type: lo :: HasApproximate c_aq5z a_alY7 => Lens' c_aq5z a_alY7

Files

.travis.yml view
@@ -1,24 +1,91 @@-language: haskell-before_install:-  # Uncomment whenever hackage is down.-  # - mkdir -p ~/.cabal && cp travis/config ~/.cabal/config && cabal update-  - cabal update+# This file has been generated -- see https://github.com/hvr/multi-ghc-travis+language: c+sudo: false -  # Try installing some of the build-deps with apt-get for speed.-  - travis/cabal-apt-install $mode-  - cabal install packdeps packunused-  - export PATH=~/.cabal/bin:$PATH+cache:+  directories:+    - $HOME/.cabsnap+    - $HOME/.cabal/packages +before_cache:+  - rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log+  - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.tar++matrix:+  include:+    # some doctests require type-level tricks, only in GHC >=7.8+    - env: CABALVER=1.24 GHCVER=7.4.2 TEST=--disable-tests+      compiler: ": #GHC 7.4.2"+      addons: {apt: {packages: [cabal-install-1.24,ghc-7.4.2], sources: [hvr-ghc]}}+    - env: CABALVER=1.24 GHCVER=7.6.3 TEST=--disable-tests+      compiler: ": #GHC 7.6.3"+      addons: {apt: {packages: [cabal-install-1.24,ghc-7.6.3], sources: [hvr-ghc]}}+    - env: CABALVER=1.24 GHCVER=7.8.4+      compiler: ": #GHC 7.8.4"+      addons: {apt: {packages: [cabal-install-1.24,ghc-7.8.4], sources: [hvr-ghc]}}+    - env: CABALVER=1.24 GHCVER=7.10.3+      compiler: ": #GHC 7.10.3"+      addons: {apt: {packages: [cabal-install-1.24,ghc-7.10.3], sources: [hvr-ghc]}}+    - env: CABALVER=1.24 GHCVER=8.0.2+      compiler: ": #GHC 8.0.2"+      addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.2], sources: [hvr-ghc]}}++before_install:+ - unset CC+ - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH+ - TEST=${TEST---enable-tests}+ install:-  - cabal configure -flib-Werror $mode-  - cabal build+ - cabal --version+ - echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"+ - if [ -f $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz ];+   then+     zcat $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz >+          $HOME/.cabal/packages/hackage.haskell.org/00-index.tar;+   fi+ - travis_retry cabal update -v+ - sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config+ - cabal install --only-dependencies $TEST --dry -v > installplan.txt+ - sed -i -e '1,/^Resolving /d' installplan.txt; cat installplan.txt +# check whether current requested install-plan matches cached package-db snapshot+ - if diff -u $HOME/.cabsnap/installplan.txt installplan.txt;+   then+     echo "cabal build-cache HIT";+     rm -rfv .ghc;+     cp -a $HOME/.cabsnap/ghc $HOME/.ghc;+     cp -a $HOME/.cabsnap/lib $HOME/.cabsnap/share $HOME/.cabsnap/bin $HOME/.cabal/;+   else+     echo "cabal build-cache MISS";+     rm -rf $HOME/.cabsnap;+     mkdir -p $HOME/.ghc $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin;+     cabal install -j --only-dependencies $TEST;+   fi++# snapshot package-db on cache miss+ - if [ ! -d $HOME/.cabsnap ];+   then+      echo "snapshotting package-db to build-cache";+      mkdir $HOME/.cabsnap;+      cp -a $HOME/.ghc $HOME/.cabsnap/ghc;+      cp -a $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin installplan.txt $HOME/.cabsnap/;+   fi++# Here starts the actual work to be performed for the package under test;+# any command which exits with a non-zero exit code causes the build to fail. script:-  - $script-  - packdeps approximate.cabal-  - packunused-  - hlint src --cpp-define HLINT+ - if [ -f configure.ac ]; then autoreconf -i; fi+ - cabal configure $TEST -v2  # -v2 provides useful information for debugging+ - cabal build   # this builds all libraries and executables (including tests/benchmarks)+ - if [ $TEST = "--enable-tests" ]; then cabal test; fi+ - cabal sdist   # tests that a source-distribution can be generated +# Check that the resulting source distribution can be built & installed.+# If there are no other `.tar.gz` files in `dist`, this can be even simpler:+# `cabal install --force-reinstalls dist/*-*.tar.gz`+ - SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz &&+   (cd dist && cabal install --force-reinstalls "$SRC_TGZ")+ notifications:   irc:     channels:@@ -27,5 +94,4 @@     template:       - "\x0313approximate\x03/\x0306%{branch}\x03 \x0314%{commit}\x03 %{build_url} %{message}" -env:-  - mode="--enable-tests" script="cabal test --show-details=always"+# EOF
CHANGELOG.markdown view
@@ -1,3 +1,11 @@+0.3+---+* Replace use of `Hashable1` from `hashable-extras` in favor of `Hashable` from+  `hashable-1.2.5.0`. As a result, the `hashable-extras` dependency has been removed.+* Revamp `Setup.hs` to use `cabal-doctest`. This makes it build+  with `Cabal-2.0`, and makes the `doctest`s work with `cabal new-build` and+  sandboxes.+ 0.2.2.3 ------- * Added support for `safecopy` 0.9 and `cereal` 0.5
Setup.lhs view
@@ -1,55 +1,34 @@-#!/usr/bin/runhaskell \begin{code}+{-# LANGUAGE CPP #-} {-# OPTIONS_GHC -Wall #-} module Main (main) where -import Data.List ( nub )-import Data.Version ( showVersion )-import Distribution.Package ( PackageName(PackageName), Package, PackageId, InstalledPackageId, packageVersion, packageName )-import Distribution.PackageDescription ( PackageDescription(), TestSuite(..) )-import Distribution.Simple ( defaultMainWithHooks, UserHooks(..), simpleUserHooks )-import Distribution.Simple.Utils ( rewriteFile, createDirectoryIfMissingVerbose, copyFiles )-import Distribution.Simple.BuildPaths ( autogenModulesDir )-import Distribution.Simple.Setup ( BuildFlags(buildVerbosity), Flag(..), fromFlag, HaddockFlags(haddockDistPref))-import Distribution.Simple.LocalBuildInfo ( withLibLBI, withTestLBI, LocalBuildInfo(), ComponentLocalBuildInfo(componentPackageDeps) )-import Distribution.Text ( display )-import Distribution.Verbosity ( Verbosity, normal )-import System.FilePath ( (</>) )+#ifndef MIN_VERSION_cabal_doctest+#define MIN_VERSION_cabal_doctest(x,y,z) 0+#endif +#if MIN_VERSION_cabal_doctest(1,0,0)++import Distribution.Extra.Doctest ( defaultMainWithDoctests ) main :: IO ()-main = defaultMainWithHooks simpleUserHooks-  { buildHook = \pkg lbi hooks flags -> do-     generateBuildModule (fromFlag (buildVerbosity flags)) pkg lbi-     buildHook simpleUserHooks pkg lbi hooks flags-  , postHaddock = \args flags pkg lbi -> do-     copyFiles normal (haddockOutputDir flags pkg) []-     postHaddock simpleUserHooks args flags pkg lbi-  }+main = defaultMainWithDoctests "doctests" -haddockOutputDir :: Package p => HaddockFlags -> p -> FilePath-haddockOutputDir flags pkg = destDir where-  baseDir = case haddockDistPref flags of-    NoFlag -> "."-    Flag x -> x-  destDir = baseDir </> "doc" </> "html" </> display (packageName pkg)+#else -generateBuildModule :: Verbosity -> PackageDescription -> LocalBuildInfo -> IO ()-generateBuildModule verbosity pkg lbi = do-  let dir = autogenModulesDir lbi-  createDirectoryIfMissingVerbose verbosity True dir-  withLibLBI pkg lbi $ \_ libcfg -> do-    withTestLBI pkg lbi $ \suite suitecfg -> do-      rewriteFile (dir </> "Build_" ++ testName suite ++ ".hs") $ unlines-        [ "module Build_" ++ testName suite ++ " where"-        , "deps :: [String]"-        , "deps = " ++ (show $ formatdeps (testDeps libcfg suitecfg))-        ]-  where-    formatdeps = map (formatone . snd)-    formatone p = case packageName p of-      PackageName n -> n ++ "-" ++ showVersion (packageVersion p)+#ifdef MIN_VERSION_Cabal+-- If the macro is defined, we have new cabal-install,+-- but for some reason we don't have cabal-doctest in package-db+--+-- Probably we are running cabal sdist, when otherwise using new-build+-- workflow+import Warning ()+#endif -testDeps :: ComponentLocalBuildInfo -> ComponentLocalBuildInfo -> [(InstalledPackageId, PackageId)]-testDeps xs ys = nub $ componentPackageDeps xs ++ componentPackageDeps ys+import Distribution.Simple++main :: IO ()+main = defaultMain++#endif  \end{code}
+ Warning.hs view
@@ -0,0 +1,5 @@+module Warning+  {-# WARNING ["You are configuring this package without cabal-doctest installed.",+               "The doctests test-suite will not work as a result.",+               "To fix this, install cabal-doctest before configuring."] #-}+  () where
approximate.cabal view
@@ -1,6 +1,6 @@ name:          approximate category:      Numeric-version:       0.2.2.3+version:       0.3 license:       BSD3 cabal-version: >= 1.8 license-file:  LICENSE@@ -11,7 +11,7 @@ bug-reports:   http://github.com/analytics/approximate/issues copyright:     Copyright (C) 2013 Edward A. Kmett build-type:    Custom-tested-with:   GHC == 7.4.1, GHC == 7.6.1, GHC == 7.8.4, GHC == 7.10.1+tested-with:   GHC == 7.4.2, GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.2 synopsis:      Approximate discrete values and numbers description:   This package provides approximate discrete values and numbers. @@ -26,7 +26,14 @@   README.markdown   CHANGELOG.markdown   HLint.hs+  Warning.hs +custom-setup+  setup-depends:+    base          >= 4.3 && <5,+    Cabal         >= 1.10,+    cabal-doctest >= 1 && <1.1+ source-repository head   type: git   location: git://github.com/analytics/approximate.git@@ -43,21 +50,20 @@ library   build-depends:     base                      >= 4.3      && < 5,-    binary                    >= 0.5      && < 0.8,+    binary                    >= 0.5      && < 0.9,     bytes                     >= 0.7      && < 1,     cereal                    >= 0.3.5    && < 0.6,-    comonad                   >= 3        && < 5,+    comonad                   >= 3        && < 6,     deepseq                   >= 1.3      && < 1.5,     ghc-prim,-    hashable                  >= 1.1.2.3  && < 1.3,-    hashable-extras           >= 0.1      && < 1,+    hashable                  >= 1.2.5    && < 1.3,     lens                      >= 3.9      && < 5,     log-domain,-    pointed                   >= 3        && < 5,+    pointed                   >= 3        && < 6,     semigroupoids             >= 3.0.2    && < 6,     semigroups                >= 0.8.4    && < 1,     safecopy                  >= 0.8.1    && < 0.10,-    vector                    >= 0.9      && < 0.12+    vector                    >= 0.9      && < 0.13    if flag(herbie)     build-depends: HerbiePlugin >= 0.1 && < 0.2
src/Data/Approximate/Mass.hs view
@@ -32,8 +32,8 @@ #endif import Data.Functor.Bind import Data.Functor.Extend-import Data.Hashable-import Data.Hashable.Extras+import Data.Hashable (Hashable(..))+import Data.Hashable.Lifted (Hashable1(..)) import Data.Pointed import Data.SafeCopy import Data.Semigroup@@ -77,7 +77,8 @@ instance Serialize a => SafeCopy (Mass a)  instance Hashable a => Hashable (Mass a)-instance Hashable1 Mass+instance Hashable1 Mass where+    liftHashWithSalt h s (Mass m x) = hashWithSalt s m `h` x  instance Serial1 Mass where   serializeWith f (Mass p a) = serialize p >> f a
src/Data/Approximate/Type.hs view
@@ -36,8 +36,8 @@ import Data.Foldable #endif import Data.Functor.Apply-import Data.Hashable-import Data.Hashable.Extras+import Data.Hashable (Hashable(..))+import Data.Hashable.Lifted (Hashable1(..)) import Data.Monoid import Data.Pointed import Data.SafeCopy@@ -69,7 +69,9 @@ instance Serialize a => SafeCopy (Approximate a)  instance Hashable a => Hashable (Approximate a)-instance Hashable1 Approximate+instance Hashable1 Approximate where+    liftHashWithSalt h s (Approximate c low est high) =+        hashWithSalt s c `h` low `h` est `h` high  instance Serial a => Serial (Approximate a) 
+ tests/doctests.hs view
@@ -0,0 +1,25 @@+-----------------------------------------------------------------------------+-- |+-- Module      :  Main (doctests)+-- Copyright   :  (C) 2012-14 Edward Kmett+-- License     :  BSD-style (see the file LICENSE)+-- Maintainer  :  Edward Kmett <ekmett@gmail.com>+-- Stability   :  provisional+-- Portability :  portable+--+-- This module provides doctests for a project based on the actual versions+-- of the packages it was built with. It requires a corresponding Setup.lhs+-- to be added to the project+-----------------------------------------------------------------------------+module Main where++import Build_doctests (flags, pkgs, module_sources)+import Data.Foldable (traverse_)+import Test.DocTest++main :: IO ()+main = do+    traverse_ putStrLn args+    doctest args+  where+    args = flags ++ pkgs ++ module_sources
− tests/doctests.hsc
@@ -1,74 +0,0 @@-{-# LANGUAGE CPP #-}-{-# LANGUAGE ForeignFunctionInterface #-}--------------------------------------------------------------------------------- |--- Module      :  Main (doctests)--- Copyright   :  (C) 2012-13 Edward Kmett--- License     :  BSD-style (see the file LICENSE)--- Maintainer  :  Edward Kmett <ekmett@gmail.com>--- Stability   :  provisional--- Portability :  portable------ This module provides doctests for a project based on the actual versions--- of the packages it was built with. It requires a corresponding Setup.lhs--- to be added to the project-------------------------------------------------------------------------------module Main where--import Build_doctests (deps)-import Control.Applicative-import Control.Monad-import Data.List-import System.Directory-import System.FilePath-import Test.DocTest--##if defined(mingw32_HOST_OS)-##if defined(i386_HOST_ARCH)-##define USE_CP-import Control.Applicative-import Control.Exception-import Foreign.C.Types-foreign import stdcall "windows.h SetConsoleCP" c_SetConsoleCP :: CUInt -> IO Bool-foreign import stdcall "windows.h GetConsoleCP" c_GetConsoleCP :: IO CUInt-##elif defined(x86_64_HOST_ARCH)-##define USE_CP-import Control.Applicative-import Control.Exception-import Foreign.C.Types-foreign import ccall "windows.h SetConsoleCP" c_SetConsoleCP :: CUInt -> IO Bool-foreign import ccall "windows.h GetConsoleCP" c_GetConsoleCP :: IO CUInt-##endif-##endif---- | Run in a modified codepage where we can print UTF-8 values on Windows.-withUnicode :: IO a -> IO a-##ifdef USE_CP-withUnicode m = do-  cp <- c_GetConsoleCP-  (c_SetConsoleCP 65001 >> m) `finally` c_SetConsoleCP cp-##else-withUnicode m = m-##endif--main :: IO ()-main = withUnicode $ getSources >>= \sources -> doctest $-    "-isrc"-  : "-idist/build/autogen"-  : "-optP-include"-  : "-optPdist/build/autogen/cabal_macros.h"-  : "-hide-all-packages"-  : "-Iincludes"-  : map ("-package="++) deps ++ sources--getSources :: IO [FilePath]-getSources = filter (isSuffixOf ".hs") <$> go "src"-  where-    go dir = do-      (dirs, files) <- getFilesAndDirectories dir-      (files ++) . concat <$> mapM go dirs--getFilesAndDirectories :: FilePath -> IO ([FilePath], [FilePath])-getFilesAndDirectories dir = do-  c <- map (dir </>) . filter (`notElem` ["..", "."]) <$> getDirectoryContents dir-  (,) <$> filterM doesDirectoryExist c <*> filterM doesFileExist c