th-lift-instances 0.1.7 → 0.1.8
raw patch · 3 files changed
+7/−71 lines, 3 filessetup-changedPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- .travis.yml +3/−0
- Setup.hs +2/−69
- th-lift-instances.cabal +2/−2
.travis.yml view
@@ -25,6 +25,9 @@ - env: GHCVER=7.10.2 CABALVER=1.22 ROOT=1 compiler: ": #GHC 7.10.2" addons: {apt: {packages: [cabal-install-1.22, ghc-7.10.2, alex-3.1.4, happy-1.19.5], sources: [hvr-ghc]}}+ - env: GHCVER=8.0.1 CABALVER=1.24+ compiler: ": #GHC 8.0.1"+ addons: {apt: {packages: [cabal-install-1.24, ghc-8.0.1, alex-3.1.7, happy-1.19.5], sources: [hvr-ghc]}} - env: GHCVER=head CABALVER=head ALLOW_NEWER="template-haskell" compiler: ": #GHC head" addons: {apt: {packages: [cabal-install-head, ghc-head, alex-3.1.4, happy-1.19.5], sources: [hvr-ghc]}}
Setup.hs view
@@ -1,69 +1,2 @@-{-# OPTIONS_GHC -Wall #-}-module Main (main) where--import Data.IORef-import Data.List ( nub )-import Data.Version ( showVersion )-import Distribution.Package ( PackageName(PackageName), PackageId, InstalledPackageId, packageVersion, packageName )-import Distribution.PackageDescription ( PackageDescription(), TestSuite(..), hsSourceDirs, libBuildInfo, buildInfo)-import Distribution.Simple ( defaultMainWithHooks, UserHooks(..), simpleUserHooks )-import Distribution.Simple.BuildPaths ( autogenModulesDir )-import Distribution.Simple.LocalBuildInfo ( withLibLBI, withTestLBI, withExeLBI, ComponentLocalBuildInfo(), LocalBuildInfo(), componentPackageDeps )-import Distribution.Simple.Setup ( BuildFlags(buildVerbosity), fromFlag, buildDistPref, defaultDistPref, fromFlagOrDefault )-import Distribution.Simple.Utils ( rewriteFile, createDirectoryIfMissingVerbose )-import Distribution.Verbosity ( Verbosity )-import System.Directory ( canonicalizePath )-import System.FilePath ( (</>) )--main :: IO ()-main = defaultMainWithHooks simpleUserHooks- { buildHook = \pkg lbi hooks flags -> do- generateBuildModule (fromFlag (buildVerbosity flags)) pkg lbi flags- buildHook simpleUserHooks pkg lbi hooks flags- }---- Very ad-hoc implementation of difference lists-singletonDL :: a -> [a] -> [a]-singletonDL = (:)--emptyDL :: [a] -> [a]-emptyDL = id--appendDL :: ([a] -> [a]) -> ([a] -> [a]) -> [a] -> [a]-appendDL x y = x . y--generateBuildModule :: Verbosity -> PackageDescription -> LocalBuildInfo -> BuildFlags -> IO ()-generateBuildModule verbosity pkg lbi flags = do- let dir = autogenModulesDir lbi- createDirectoryIfMissingVerbose verbosity True dir- withTestLBI pkg lbi $ \suite suitelbi -> do- srcDirs <- mapM canonicalizePath $ hsSourceDirs $ testBuildInfo suite- distDir <- canonicalizePath $ fromFlagOrDefault defaultDistPref $ buildDistPref flags-- depsVar <- newIORef emptyDL- withLibLBI pkg lbi $ \lib liblbi ->- modifyIORef depsVar $ appendDL . singletonDL $ depsEntry (libBuildInfo lib) liblbi suitelbi- withExeLBI pkg lbi $ \exe exelbi ->- modifyIORef depsVar $ appendDL . singletonDL $ depsEntry (buildInfo exe) exelbi suitelbi- deps <- fmap ($ []) $ readIORef depsVar-- rewriteFile (dir </> "Build_" ++ map fixchar (testName suite) ++ ".hs") $ unlines- [ "module Build_" ++ map fixchar (testName suite) ++ " where"- , "getDistDir :: FilePath"- , "getDistDir = " ++ show distDir- , "getSrcDirs :: [FilePath]"- , "getSrcDirs = " ++ show srcDirs- , "deps :: [([FilePath], [String])]"- , "deps = " ++ show deps- ]-- where- formatdeps = map (formatone . snd)- formatone p = case packageName p of- PackageName n -> n ++ "-" ++ showVersion (packageVersion p)- depsEntry targetbi targetlbi suitelbi = (hsSourceDirs targetbi, formatdeps $ testDeps targetlbi suitelbi)- fixchar '-' = '_'- fixchar c = c--testDeps :: ComponentLocalBuildInfo -> ComponentLocalBuildInfo -> [(InstalledPackageId, PackageId)]-testDeps xs ys = nub $ componentPackageDeps xs ++ componentPackageDeps ys+import Distribution.Simple+main = defaultMain
th-lift-instances.cabal view
@@ -1,7 +1,7 @@ name: th-lift-instances-version: 0.1.7+version: 0.1.8 cabal-version: >=1.10-build-type: Custom+build-type: Simple license: BSD3 license-file: LICENSE copyright: Copyright (C) 2013-2016 Benno Fünfstück