mirror of
https://github.com/mikeizbicki/ifcxt.git
synced 2024-11-20 14:02:03 +03:00
Merge pull request #8 from ddssff/master
Support ghc-8, add travis config
This commit is contained in:
commit
049de7568f
32
.travis.yml
Normal file
32
.travis.yml
Normal file
@ -0,0 +1,32 @@
|
||||
language: c
|
||||
|
||||
# explicitly request container-based infrastructure
|
||||
sudo: false
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- env: CABALVER=1.22 GHCVER=7.10.3
|
||||
addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.3],sources: [hvr-ghc]}}
|
||||
- env: CABALVER=1.24 GHCVER=8.0.2
|
||||
addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.2],sources: [hvr-ghc]}}
|
||||
- env: CABALVER=2.0 GHCVER=8.2.2
|
||||
addons: {apt: {packages: [cabal-install-2.0,ghc-8.2.2],sources: [hvr-ghc]}}
|
||||
- env: CABALVER=head GHCVER=head
|
||||
addons: {apt: {packages: [cabal-install-head,ghc-head], sources: [hvr-ghc]}}
|
||||
|
||||
allow_failures:
|
||||
- env: CABALVER=head GHCVER=head
|
||||
- env: CABALVER=2.0 GHCVER=8.2.2
|
||||
|
||||
before_install:
|
||||
- export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH
|
||||
|
||||
install:
|
||||
- travis_retry cabal update
|
||||
- cabal install --only-dependencies --enable-tests --force-reinstalls
|
||||
|
||||
script:
|
||||
- cabal configure --enable-tests
|
||||
#--enable-library-coverage || cabal configure --enable-tests --enable-coverage
|
||||
- cabal build
|
||||
- cabal test
|
@ -53,11 +53,12 @@ library
|
||||
-- other-modules:
|
||||
default-extensions:
|
||||
ConstraintKinds,
|
||||
CPP,
|
||||
Rank2Types,
|
||||
FlexibleInstances,
|
||||
FlexibleContexts,
|
||||
TemplateHaskell
|
||||
build-depends: base >=4.8 && <4.9, template-haskell >=2.10 && <2.11
|
||||
build-depends: base >=4.8, template-haskell >=2.10
|
||||
hs-source-dirs: src
|
||||
default-language: Haskell2010
|
||||
|
||||
|
11
src/IfCxt.hs
11
src/IfCxt.hs
@ -34,13 +34,21 @@ mkIfCxtInstances :: Name -> Q [Dec]
|
||||
mkIfCxtInstances n = do
|
||||
info <- reify ''IfCxt
|
||||
let instancesOfIfCxt = case info of
|
||||
#if MIN_VERSION_template_haskell(2,11,0)
|
||||
ClassI _ xs -> map (\(InstanceD _ _ (AppT _ t) _) -> t) xs
|
||||
#else
|
||||
ClassI _ xs -> map (\(InstanceD _ (AppT _ t) _) -> t) xs
|
||||
#endif
|
||||
|
||||
isInstanceOfIfCxt t = t `elem` instancesOfIfCxt
|
||||
|
||||
info <- reify n
|
||||
case info of
|
||||
#if MIN_VERSION_template_haskell(2,11,0)
|
||||
ClassI _ xs -> fmap concat $ forM xs $ \(InstanceD _ cxt (AppT classt t) ys) -> return $
|
||||
#else
|
||||
ClassI _ xs -> fmap concat $ forM xs $ \(InstanceD cxt (AppT classt t) ys) -> return $
|
||||
#endif
|
||||
if isInstanceOfIfCxt (AppT classt t)
|
||||
then []
|
||||
else mkInstance cxt classt t n
|
||||
@ -49,6 +57,9 @@ mkIfCxtInstances n = do
|
||||
mkInstance :: Cxt -> Type -> Type -> Name -> [Dec]
|
||||
mkInstance cxt classt t n = [
|
||||
InstanceD
|
||||
#if MIN_VERSION_template_haskell(2,11,0)
|
||||
Nothing
|
||||
#endif
|
||||
(map relaxCxt cxt)
|
||||
(relaxCxt (AppT (ConT n) t))
|
||||
[ FunD 'ifCxt
|
||||
|
Loading…
Reference in New Issue
Block a user