Skip to content

Commit

Permalink
Improve CI coverage -- now on GHC 8.4! (polysemy-research#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
isovector authored Jun 19, 2019
1 parent aab9cbc commit 29216ce
Show file tree
Hide file tree
Showing 27 changed files with 190 additions and 128 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ stack.yaml.lock
core-html/
*~
*.prof
.ghc.environment.*
dist-newstyle
13 changes: 6 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,8 @@ cabal: "2.4"

matrix:
include:
- ghc: "8.6.3"
# - ghc: "8.4.4"
# - ghc: "8.2.2"
# - ghc: "8.0.2"
# - ghc: "7.10.3"
# - ghc: "7.8.4"
# - ghc: "7.6.3"
- ghc: "8.6.5"
- ghc: "8.4.4"

install:
- cabal --version
Expand All @@ -34,3 +29,7 @@ script:
# `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")

- cabal v2-build polysemy-plugin
- cabal v2-test --enable-test polysemy-plugin

3 changes: 3 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,6 @@

## Unreleased changes

- Lots of hard work on the package and CI infrastructure to make it green on
GHC 8.4.4 (thanks to @jkachmar)

5 changes: 3 additions & 2 deletions bench/Poly.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{-# LANGUAGE BlockArguments #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
Expand Down Expand Up @@ -57,7 +56,9 @@ runConsoleBoring :: [String] -> Sem (Console ': r) a -> Sem r ([String], a)
runConsoleBoring inputs
= runFoldMapOutput (:[])
. runListInput inputs
. reinterpret2 \case
. reinterpret2
(\case
ReadLine -> maybe "" id <$> input
WriteLine msg -> output msg
)

6 changes: 6 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
packages: . polysemy-plugin

jobs: $ncpus

package *
ghc-options: +RTS -A128m -n2m -RTS
26 changes: 18 additions & 8 deletions package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ category: Language
description: Please see the README on GitHub at <https://github.com/isovector/polysemy#readme>

dependencies:
- base >= 4.7 && < 5
- containers >= 0.6 && <= 0.7
- mtl >= 2.2.2 && <3
- syb >= 0.7 && <= 0.8
- template-haskell >= 2.14.0.0 && <2.15
- th-abstraction >= 0.3 && <= 0.4
- transformers >= 0.5.5.0 && < 0.6
- base >= 4.9 && < 5
- containers >= 0.5 && < 0.7
- mtl >= 2.2.2 && < 3
- syb >= 0.7 && < 0.8
- template-haskell >= 2.12.0.0 && < 3
- th-abstraction >= 0.3.1.0 && < 0.4
- transformers >= 0.5.2.0 && < 0.6
- first-class-families >= 0.5.0.0 && < 0.6

default-extensions:
Expand All @@ -40,6 +40,12 @@ default-extensions:
- TypeFamilies
- UnicodeSyntax

when:
- condition: impl(ghc < 8.6)
default-extensions:
- MonadFailDesugaring
- TypeInType

flags:
dump-core:
description: Dump HTML for the core generated by GHC during compilation
Expand All @@ -63,6 +69,10 @@ library:
- -fplugin=DumpCore
- -fplugin-opt DumpCore:core-html

- condition: impl(ghc < 8.2.2)
dependencies:
- unsupported-ghc-version > 1 && < 1

- condition: flag(error-messages)
then: {}
else:
Expand All @@ -80,7 +90,7 @@ tests:
- hspec-discover >= 2.0
dependencies:
- polysemy
- inspection-testing >= 0.4.1.1 && < 0.5
- inspection-testing >= 0.4.2.1 && < 0.5
- hspec >= 2.6.0 && < 3
- doctest >= 0.16.0.1 && < 0.17

Expand Down
16 changes: 8 additions & 8 deletions polysemy-plugin/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ category: Polysemy
description: Please see the README on GitHub at <https://github.com/isovector/polysemy/tree/master/polysemy-plugin#readme>

dependencies:
- base >= 4.7 && < 5
- ghc >= 8.6.3 && < 8.7
- base >= 4.9 && < 5
- ghc >= 8.4.4 && < 9
- ghc-tcplugins-extra >= 0.3 && < 0.4
- polysemy >= 0.1
- syb >= 0.7 && <0.8
- transformers >= 0.5.5.0 && < 0.6
- containers >= 0.6 && <= 0.7
- syb >= 0.7 && < 0.8
- transformers >= 0.5.2.0 && < 0.6
- containers >= 0.5 && < 0.7

library:
source-dirs: src
Expand All @@ -37,13 +37,13 @@ tests:
- -with-rtsopts=-N
- -fplugin=Polysemy.Plugin
build-tools:
- hspec-discover >= 2.0
- hspec-discover
dependencies:
- polysemy >= 0.3
- polysemy
- polysemy-plugin
- hspec >= 2.6.0 && < 3
- should-not-typecheck >= 2.1.0 && < 3
- inspection-testing >= 0.4.2 && < 0.5
- inspection-testing >= 0.4.2.1 && < 0.5

default-extensions:
- DataKinds
Expand Down
24 changes: 12 additions & 12 deletions polysemy-plugin/polysemy-plugin.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cabal-version: 1.12
--
-- see: https://github.com/sol/hpack
--
-- hash: 23a79817050b23bbea757d488d2dca20d51fd3949f893f7898b29a9d0f1ea38c
-- hash: 67eaa9259909a5401e1bbdf179fc3263ec3b57afd9951ae709d347f390e9c541

name: polysemy-plugin
version: 0.2.1.0
Expand Down Expand Up @@ -39,13 +39,13 @@ library
src
default-extensions: DataKinds DeriveFunctor FlexibleContexts GADTs LambdaCase PolyKinds RankNTypes ScopedTypeVariables StandaloneDeriving TypeApplications TypeOperators TypeFamilies UnicodeSyntax
build-depends:
base >=4.7 && <5
, containers >=0.6 && <=0.7
, ghc >=8.6.3 && <8.7
base >=4.9 && <5
, containers >=0.5 && <0.7
, ghc >=8.4.4 && <9
, ghc-tcplugins-extra >=0.3 && <0.4
, polysemy >=0.1
, syb >=0.7 && <0.8
, transformers >=0.5.5.0 && <0.6
, transformers >=0.5.2.0 && <0.6
default-language: Haskell2010

test-suite polysemy-plugin-test
Expand All @@ -64,17 +64,17 @@ test-suite polysemy-plugin-test
default-extensions: DataKinds DeriveFunctor FlexibleContexts GADTs LambdaCase PolyKinds RankNTypes ScopedTypeVariables StandaloneDeriving TypeApplications TypeOperators TypeFamilies UnicodeSyntax
ghc-options: -threaded -rtsopts -with-rtsopts=-N -fplugin=Polysemy.Plugin
build-tool-depends:
hspec-discover:hspec-discover >=2.0
hspec-discover:hspec-discover
build-depends:
base >=4.7 && <5
, containers >=0.6 && <=0.7
, ghc >=8.6.3 && <8.7
base >=4.9 && <5
, containers >=0.5 && <0.7
, ghc >=8.4.4 && <9
, ghc-tcplugins-extra >=0.3 && <0.4
, hspec >=2.6.0 && <3
, inspection-testing >=0.4.2 && <0.5
, polysemy >=0.3
, inspection-testing >=0.4.2.1 && <0.5
, polysemy
, polysemy-plugin
, should-not-typecheck >=2.1.0 && <3
, syb >=0.7 && <0.8
, transformers >=0.5.5.0 && <0.6
, transformers >=0.5.2.0 && <0.6
default-language: Haskell2010
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ containsName :: CoreBndr -> CoreExpr -> Bool
containsName n e =
getAny $
everything
(<>)
mappend
(mkQ (Any False) $ matches n)
e

Expand Down
4 changes: 4 additions & 0 deletions polysemy-plugin/src/Polysemy/Plugin/Phases.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{-# LANGUAGE CPP #-}

module Polysemy.Plugin.Phases
( extraPhases
) where
Expand Down Expand Up @@ -28,7 +30,9 @@ extraPhases dflags =
base_mode = SimplMode
{ sm_phase = error "base_mode"
, sm_names = []
#if __GLASGOW_HASKELL__ >= 804
, sm_dflags = dflags
#endif
, sm_rules = option Opt_EnableRewriteRules
, sm_eta_expand = rules_on
, sm_inline = True
Expand Down
1 change: 0 additions & 1 deletion polysemy-plugin/test/ExampleSpec.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE BlockArguments #-}
{-# OPTIONS_GHC -fplugin=Polysemy.Plugin #-}

module ExampleSpec where
Expand Down
5 changes: 5 additions & 0 deletions polysemy-plugin/test/InlineRecursiveCallsSpec.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE TemplateHaskell #-}

{-# OPTIONS_GHC -O2 #-}

#if __GLASGOW_HASKELL__ < 804
{-# OPTIONS_GHC -fplugin=Test.Inspection.Plugin #-}
#endif

module InlineRecursiveCallsSpec
( spec
Expand Down
6 changes: 2 additions & 4 deletions polysemy-plugin/test/PluginSpec.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE BlockArguments #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE OverloadedStrings #-}

Expand Down Expand Up @@ -37,9 +36,8 @@ oStrState = put "hello"
err :: Member (Error e) r => Sem r Bool
err =
catch
do
throw undefined
\_ -> pure True
(throw undefined)
(\_ -> pure True)


errState :: Num s => Members '[Error e, State s] r => Sem r Bool
Expand Down
1 change: 0 additions & 1 deletion polysemy-plugin/test/VDQSpec.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE BlockArguments #-}
{-# OPTIONS_GHC -fplugin=Polysemy.Plugin #-}

module VDQSpec where
Expand Down
49 changes: 29 additions & 20 deletions polysemy.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cabal-version: 1.12
--
-- see: https://github.com/sol/hpack
--
-- hash: 8215f1fa69bdaae106988aaf84f4a2dd2338231d1fc11ddf7dd30a9d8b61449b
-- hash: 3bb11d1562f0640e892b918e3de6086196562200410a660b14851704b64175a0

name: polysemy
version: 0.4.0.0
Expand Down Expand Up @@ -69,18 +69,23 @@ library
default-extensions: DataKinds DeriveFunctor FlexibleContexts GADTs LambdaCase PolyKinds RankNTypes ScopedTypeVariables StandaloneDeriving TypeApplications TypeOperators TypeFamilies UnicodeSyntax
ghc-options: -Wall
build-depends:
base >=4.7 && <5
, containers >=0.6 && <=0.7
base >=4.9 && <5
, containers >=0.5 && <0.7
, first-class-families >=0.5.0.0 && <0.6
, mtl >=2.2.2 && <3
, syb >=0.7 && <=0.8
, template-haskell >=2.14.0.0 && <2.15
, th-abstraction >=0.3 && <=0.4
, transformers >=0.5.5.0 && <0.6
, syb >=0.7 && <0.8
, template-haskell >=2.12.0.0 && <3
, th-abstraction >=0.3.1.0 && <0.4
, transformers >=0.5.2.0 && <0.6
if impl(ghc < 8.6)
default-extensions: MonadFailDesugaring TypeInType
if flag(dump-core)
ghc-options: -fplugin=DumpCore -fplugin-opt DumpCore:core-html
build-depends:
dump-core
if impl(ghc < 8.2.2)
build-depends:
unsupported-ghc-version >1 && <1
if flag(error-messages)
else
cpp-options: -DNO_ERROR_MESSAGES
Expand All @@ -107,18 +112,20 @@ test-suite polysemy-test
build-tool-depends:
hspec-discover:hspec-discover >=2.0
build-depends:
base >=4.7 && <5
, containers >=0.6 && <=0.7
base >=4.9 && <5
, containers >=0.5 && <0.7
, doctest >=0.16.0.1 && <0.17
, first-class-families >=0.5.0.0 && <0.6
, hspec >=2.6.0 && <3
, inspection-testing >=0.4.1.1 && <0.5
, inspection-testing >=0.4.2.1 && <0.5
, mtl >=2.2.2 && <3
, polysemy
, syb >=0.7 && <=0.8
, template-haskell >=2.14.0.0 && <2.15
, th-abstraction >=0.3 && <=0.4
, transformers >=0.5.5.0 && <0.6
, syb >=0.7 && <0.8
, template-haskell >=2.12.0.0 && <3
, th-abstraction >=0.3.1.0 && <0.4
, transformers >=0.5.2.0 && <0.6
if impl(ghc < 8.6)
default-extensions: MonadFailDesugaring TypeInType
default-language: Haskell2010

benchmark polysemy-bench
Expand All @@ -131,16 +138,18 @@ benchmark polysemy-bench
bench
default-extensions: DataKinds DeriveFunctor FlexibleContexts GADTs LambdaCase PolyKinds RankNTypes ScopedTypeVariables StandaloneDeriving TypeApplications TypeOperators TypeFamilies UnicodeSyntax
build-depends:
base >=4.7 && <5
, containers >=0.6 && <=0.7
base >=4.9 && <5
, containers >=0.5 && <0.7
, criterion
, first-class-families >=0.5.0.0 && <0.6
, free
, freer-simple
, mtl
, polysemy
, syb >=0.7 && <=0.8
, template-haskell >=2.14.0.0 && <2.15
, th-abstraction >=0.3 && <=0.4
, transformers >=0.5.5.0 && <0.6
, syb >=0.7 && <0.8
, template-haskell >=2.12.0.0 && <3
, th-abstraction >=0.3.1.0 && <0.4
, transformers >=0.5.2.0 && <0.6
if impl(ghc < 8.6)
default-extensions: MonadFailDesugaring TypeInType
default-language: Haskell2010
Loading

0 comments on commit 29216ce

Please sign in to comment.