Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use quantified constraints in OptionsGrammar #734

Merged
merged 1 commit into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/haskell-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ jobs:
run: |
perl -i -e 'while (<ARGV>) { print unless /package-id\s+(base-compat-batteries|bs-cmpt-bttrs)-\d+(\.\d+)*/; }' .ghc.environment.*
if [ $((HCNUMVER < 90000)) -ne 0 ] ; then cd ${PKGDIR_haskell_ci} || false ; fi
if [ $((HCNUMVER < 90000)) -ne 0 ] ; then doctest --fast -XHaskell2010 -XBangPatterns -XDeriveAnyClass -XDeriveFoldable -XDeriveFunctor -XDeriveGeneric -XDeriveTraversable -XDerivingStrategies -XGeneralizedNewtypeDeriving -XNoImplicitPrelude -XScopedTypeVariables -XTypeOperators src ; fi
if [ $((HCNUMVER < 90000)) -ne 0 ] ; then doctest --fast -XHaskell2010 -XBangPatterns -XConstraintKinds -XDataKinds -XDeriveAnyClass -XDeriveFoldable -XDeriveFunctor -XDeriveGeneric -XDeriveTraversable -XDerivingStrategies -XFlexibleContexts -XFlexibleInstances -XFunctionalDependencies -XGADTs -XGeneralizedNewtypeDeriving -XMultiWayIf -XNoImplicitPrelude -XQuantifiedConstraints -XRankNTypes -XScopedTypeVariables -XTypeApplications -XTypeOperators -XUndecidableInstances -XUndecidableSuperClasses -XViewPatterns src ; fi
if [ $((HCNUMVER < 90000)) -ne 0 ] ; then cd ${PKGDIR_cabal_install_parsers} || false ; fi
if [ $((HCNUMVER < 90000)) -ne 0 ] ; then doctest --fast -XHaskell2010 src ; fi
- name: docspec
Expand Down
53 changes: 34 additions & 19 deletions haskell-ci.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,37 @@ flag ShellCheck
default: True
manual: True

library haskell-ci-internal
common language
default-language: Haskell2010
hs-source-dirs: src
default-extensions:
BangPatterns
ConstraintKinds
DataKinds
DeriveAnyClass
DeriveFoldable
DeriveFunctor
DeriveGeneric
DeriveTraversable
DerivingStrategies
FlexibleContexts
FlexibleInstances
FunctionalDependencies
GADTs
GeneralizedNewtypeDeriving
MultiWayIf
NoImplicitPrelude
QuantifiedConstraints
RankNTypes
ScopedTypeVariables
TypeApplications
TypeOperators
UndecidableInstances
UndecidableSuperClasses
ViewPatterns

library haskell-ci-internal
import: language
hs-source-dirs: src
ghc-options:
-Wall -Wincomplete-uni-patterns -Wincomplete-record-updates
-Wcompat -Wnoncanonical-monad-instances
Expand Down Expand Up @@ -123,19 +151,6 @@ library haskell-ci-internal
HaskellCI.VersionInfo
HaskellCI.YamlSyntax

default-extensions:
BangPatterns
DeriveAnyClass
DeriveFoldable
DeriveFunctor
DeriveGeneric
DeriveTraversable
DerivingStrategies
GeneralizedNewtypeDeriving
NoImplicitPrelude
ScopedTypeVariables
TypeOperators

other-extensions:
CPP
NamedFieldPuns
Expand Down Expand Up @@ -194,10 +209,10 @@ executable haskell-ci
default-language: Haskell2010

test-suite golden
default-language: Haskell2010
type: exitcode-stdio-1.0
main-is: Tests.hs
hs-source-dirs: test
import: language
type: exitcode-stdio-1.0
main-is: Tests.hs
hs-source-dirs: test

-- inherited constraints via lib:haskell-ci
build-depends:
Expand Down
2 changes: 1 addition & 1 deletion haskell-ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ run_cmd $CABAL v2-test $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --test-show-detai
put_info "doctest"
run_cmd perl -i -e 'while (<ARGV>) { print unless /package-id\s+(base-compat-batteries|bs-cmpt-bttrs)-\d+(\.\d+)*/; }' .ghc.environment.*
change_dir_if $((HCNUMVER < 90000)) ${PKGDIR_haskell_ci}
run_cmd_if $((HCNUMVER < 90000)) doctest --fast -XHaskell2010 -XBangPatterns -XDeriveAnyClass -XDeriveFoldable -XDeriveFunctor -XDeriveGeneric -XDeriveTraversable -XDerivingStrategies -XGeneralizedNewtypeDeriving -XNoImplicitPrelude -XScopedTypeVariables -XTypeOperators src
run_cmd_if $((HCNUMVER < 90000)) doctest --fast -XHaskell2010 -XBangPatterns -XConstraintKinds -XDataKinds -XDeriveAnyClass -XDeriveFoldable -XDeriveFunctor -XDeriveGeneric -XDeriveTraversable -XDerivingStrategies -XFlexibleContexts -XFlexibleInstances -XFunctionalDependencies -XGADTs -XGeneralizedNewtypeDeriving -XMultiWayIf -XNoImplicitPrelude -XQuantifiedConstraints -XRankNTypes -XScopedTypeVariables -XTypeApplications -XTypeOperators -XUndecidableInstances -XUndecidableSuperClasses -XViewPatterns src
change_dir_if $((HCNUMVER < 90000)) ${PKGDIR_cabal_install_parsers}
run_cmd_if $((HCNUMVER < 90000)) doctest --fast -XHaskell2010 src

Expand Down
20 changes: 11 additions & 9 deletions src/HaskellCI/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,17 @@ emptyConfig = case runEG configGrammar of

configGrammar
:: ( OptionsGrammar c g, Applicative (g Config)
, c (Identity PackageScope)
, c (Identity TestedWithJobs)
, c (Identity Ubuntu)
, c (Identity Jobs)
, c (Identity CopyFields)
, c (Identity Version)
, c (Identity Natural)
, c (Identity Components)
, c Env, c CopyFields, c HeadVersion
, c Components
, c CopyFields
, c CopyFields
, c Env
, c HeadVersion
, c Jobs
, c Natural
, c PackageScope
, c TestedWithJobs
, c Ubuntu
, c Version
, c (C.List C.FSep (Identity Installed) Installed)
, Applicative (g DoctestConfig)
, Applicative (g DocspecConfig)
Expand Down
10 changes: 3 additions & 7 deletions src/HaskellCI/OptionsGrammar.hs
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE UndecidableSuperClasses #-}
module HaskellCI.OptionsGrammar (
OptionsGrammar (..),
(C.^^^),
Expand Down Expand Up @@ -40,7 +34,9 @@ type BashCompletionAction = String

class
( C.FieldGrammar c p
, c Range, c (Identity C.VersionRange)
, forall s. Applicative (p s)
, forall a. c a => c (Identity a)
, c Range, c C.VersionRange
, c (C.List C.NoCommaFSep C.Token' String)
, c (C.List C.FSep C.Token' String)
, c (AlaSet C.NoCommaFSep C.Token' String)
Expand Down
Loading