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

Support for GHC 9.6 #155

Closed
wants to merge 4 commits into from
Closed
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
45 changes: 7 additions & 38 deletions .github/workflows/haskell-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ on:
push:
branches:
- main
- ghc96
pull_request:
branches:
- main
Expand All @@ -32,6 +33,11 @@ jobs:
strategy:
matrix:
include:
- compiler: ghc-9.6.5
compilerKind: ghc
compilerVersion: 9.6.5
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.4.5
compilerKind: ghc
compilerVersion: 9.4.5
Expand All @@ -47,16 +53,6 @@ jobs:
compilerVersion: 9.0.2
setup-method: ghcup
allow-failure: false
- compiler: ghc-8.10.7
compilerKind: ghc
compilerVersion: 8.10.7
setup-method: ghcup
allow-failure: false
- compiler: ghc-8.8.4
compilerKind: ghc
compilerVersion: 8.8.4
setup-method: hvr-ppa
allow-failure: false
fail-fast: false
steps:
- name: apt
Expand Down Expand Up @@ -178,7 +174,6 @@ jobs:
echo "packages: $GITHUB_WORKSPACE/source/large-records" >> cabal.project
if [ $((HCNUMVER < 81000)) -ne 0 ] ; then echo "packages: $GITHUB_WORKSPACE/source/large-records-benchmarks" >> cabal.project ; fi
echo "packages: $GITHUB_WORKSPACE/source/large-anon" >> cabal.project
echo "packages: $GITHUB_WORKSPACE/source/beam-large-records" >> cabal.project
echo "packages: $GITHUB_WORKSPACE/source/typelet" >> cabal.project
cat cabal.project
- name: sdist
Expand All @@ -199,8 +194,6 @@ jobs:
echo "PKGDIR_large_records_benchmarks=${PKGDIR_large_records_benchmarks}" >> "$GITHUB_ENV"
PKGDIR_large_anon="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/large-anon-[0-9.]*')"
echo "PKGDIR_large_anon=${PKGDIR_large_anon}" >> "$GITHUB_ENV"
PKGDIR_beam_large_records="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/beam-large-records-[0-9.]*')"
echo "PKGDIR_beam_large_records=${PKGDIR_beam_large_records}" >> "$GITHUB_ENV"
PKGDIR_typelet="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/typelet-[0-9.]*')"
echo "PKGDIR_typelet=${PKGDIR_typelet}" >> "$GITHUB_ENV"
rm -f cabal.project cabal.project.local
Expand All @@ -210,7 +203,6 @@ jobs:
echo "packages: ${PKGDIR_large_records}" >> cabal.project
if [ $((HCNUMVER < 81000)) -ne 0 ] ; then echo "packages: ${PKGDIR_large_records_benchmarks}" >> cabal.project ; fi
echo "packages: ${PKGDIR_large_anon}" >> cabal.project
echo "packages: ${PKGDIR_beam_large_records}" >> cabal.project
echo "packages: ${PKGDIR_typelet}" >> cabal.project
echo "package large-generics" >> cabal.project
echo " ghc-options: -Werror=missing-methods" >> cabal.project
Expand All @@ -220,29 +212,9 @@ jobs:
if [ $((HCNUMVER < 81000)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi
echo "package large-anon" >> cabal.project
echo " ghc-options: -Werror=missing-methods" >> cabal.project
echo "package beam-large-records" >> cabal.project
echo " ghc-options: -Werror=missing-methods" >> cabal.project
echo "package typelet" >> cabal.project
echo " ghc-options: -Werror=missing-methods" >> cabal.project
cat >> cabal.project <<EOF
source-repository-package
type: git
location: https://github.com/well-typed/beam
tag: f13fedc299727b2706f26cdfeff3913923cb1a79
subdir: beam-core

source-repository-package
type: git
location: https://github.com/well-typed/beam
tag: f13fedc299727b2706f26cdfeff3913923cb1a79
subdir: beam-migrate

source-repository-package
type: git
location: https://github.com/well-typed/beam
tag: f13fedc299727b2706f26cdfeff3913923cb1a79
subdir: beam-sqlite

package large-generics
ghc-options: -Werror

Expand All @@ -255,13 +227,10 @@ jobs:
package large-anon
ghc-options: -Werror

package beam-large-records
ghc-options: -Werror

package typelet
ghc-options: -Werror
EOF
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(beam-large-records|large-anon|large-generics|large-records|large-records-benchmarks|typelet)$/; }' >> cabal.project.local
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(large-anon|large-generics|large-records|large-records-benchmarks|typelet)$/; }' >> cabal.project.local
cat cabal.project
cat cabal.project.local
- name: dump install plan
Expand Down
17 changes: 8 additions & 9 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ packages: large-generics
, large-records
, large-records-benchmarks
, large-anon
, beam-large-records
-- , beam-large-records
, typelet

-- we need https://github.com/haskell-beam/beam/pull/585
source-repository-package
type: git
location: https://github.com/well-typed/beam
tag: f13fedc299727b2706f26cdfeff3913923cb1a79
subdir: beam-core beam-migrate beam-sqlite
-- source-repository-package
-- type: git
-- location: https://github.com/well-typed/beam
-- tag: f13fedc299727b2706f26cdfeff3913923cb1a79
-- subdir: beam-core beam-migrate beam-sqlite

-- enable for GHC head
-- repository head.hackage.ghc.haskell.org
Expand All @@ -33,10 +33,9 @@ package large-records-benchmarks

package large-anon
tests: True
ghc-options: -dcore-lint

package beam-large-records
tests: True
-- package beam-large-records
-- tests: True

package typelet
tests: True
12 changes: 6 additions & 6 deletions large-anon/large-anon.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 2.4
name: large-anon
version: 0.3.0
version: 0.4.0
synopsis: Scalable anonymous records
description: The @large-anon@ package provides support for anonymous
records in Haskell, with a focus on compile-time (and
Expand Down Expand Up @@ -70,23 +70,23 @@ library
Data.Record.Anon.Internal.Plugin.Source.Options

build-depends:
base >= 4.13 && < 4.18
, aeson >= 1.4.4 && < 2.2
base >= 4.13 && < 4.19
, aeson >= 1.4.4 && < 2.3
, containers >= 0.6.2 && < 0.7
, deepseq >= 1.4.4 && < 1.5
, ghc-tcplugin-api >= 0.10 && < 0.11
, hashable >= 1.3 && < 1.5
, mtl >= 2.2.1 && < 2.3
, mtl >= 2.2.1 && < 2.4
, optics-core >= 0.3 && < 0.5
, primitive >= 0.8 && < 0.9
, record-hasfield >= 1.0 && < 1.1
, sop-core >= 0.5 && < 0.6
, syb >= 0.7 && < 0.8
, tagged >= 0.8.6 && < 0.9
, typelet >= 0.1 && < 0.2
, typelet >= 0.2 && < 0.3

-- large-generics 0.2 starts using 'SmallArray' instead of 'Vector'
, large-generics >= 0.2 && < 0.3
, large-generics >= 0.3 && < 0.4

-- Whatever version is bundled with ghc
, ghc
Expand Down
8 changes: 4 additions & 4 deletions large-anon/src/Data/Record/Anon/Advanced.hs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ applyPending = A.applyPending
-- absentField r = get #c r
-- :}
-- ...
-- ...No instance for (RowHasField "c"...
-- ...No instance for...RowHasField "c"...
-- ...
--
-- Type mismatches will result in regular type errors:
Expand All @@ -226,7 +226,7 @@ applyPending = A.applyPending
-- unknownField r = get #b r
-- :}
-- ...
-- ...No instance for (RowHasField "b"...
-- ...No instance for...RowHasField "b"...
-- ...
--
-- (Note that @x@ here is a variable, not a string.) It is important that the
Expand Down Expand Up @@ -280,7 +280,7 @@ set = A.set
-- example = project
-- :}
-- ...
-- ...No instance for (SubRow...
-- ...No instance for...SubRow...
-- ...
--
-- Type inference will work through projections: field types are unified based
Expand Down Expand Up @@ -347,7 +347,7 @@ lens = A.lens
-- example r = get #b r
-- :}
-- ...
-- ...No instance for (RowHasField "b"...
-- ...No instance for...RowHasField "b"...
-- ...
merge :: Record f r -> Record f r' -> Record f (Merge r r')
merge = A.merge
Expand Down
13 changes: 11 additions & 2 deletions large-anon/src/Data/Record/Anon/Internal/Core/FieldName.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{-# LANGUAGE CPP #-}

-- | Field name
--
-- Intended for qualified import.
Expand All @@ -17,6 +19,11 @@ import Data.String

import Data.Record.Anon.Internal.Plugin.TC.GhcTcPluginAPI

#if __GLASGOW_HASKELL__ >= 906
import GHC.Data.FastString (mkFastString)
#endif


{-------------------------------------------------------------------------------
Definition
-------------------------------------------------------------------------------}
Expand Down Expand Up @@ -63,6 +70,8 @@ instance Show FieldName where
showString "fromString " . showsPrec 11 (fieldNameLabel n)

instance Outputable FieldName where
#if __GLASGOW_HASKELL__ >= 906
ppr = ppr . mkFastString . fieldNameLabel
#else
ppr = ppr . fieldNameLabel


#endif
53 changes: 49 additions & 4 deletions large-anon/src/Data/Record/Anon/Internal/Plugin/Source/GhcShim.hs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ import GHC.Driver.Session (getDynFlags)
import GHC.Types.Name (mkInternalName)
import GHC.Types.Name.Occurrence
import GHC.Types.Name.Reader (RdrName(Exact), rdrNameOcc, mkRdrQual, mkRdrUnqual)
import GHC.Types.SrcLoc (LayoutInfo(NoLayoutInfo))
import GHC.Types.Unique (Unique)
import GHC.Types.Unique.Supply (takeUniqFromSupply)
import GHC.Utils.Monad
Expand All @@ -113,7 +112,9 @@ import GHC.Driver.Env.Types
import GHC.Driver.Errors
import GHC.Types.SourceText (SourceText(NoSourceText))
import GHC.Unit.Finder (findImportedModule, FindResult(Found))
#if __GLASGOW_HASKELL__ < 906
import GHC.Unit.Types (IsBootInterface(NotBoot))
#endif
#else
import GHC.Driver.Finder (findImportedModule)
import GHC.Driver.Types
Expand All @@ -131,14 +132,32 @@ import GHC.Driver.Config.Diagnostic (initDiagOpts)
import GHC.Driver.Errors.Types (GhcMessage(..))
import GHC.Iface.Env (lookupNameCache)
import GHC.Rename.Names (renamePkgQual)
import GHC.Types.Error (MsgEnvelope(..), mkMessages)
import GHC.Types.Error (mkMessages)
import GHC.Types.Name.Cache (NameCache, takeUniqFromNameCache)
import GHC.Types.PkgQual (RawPkgQual(NoRawPkgQual))
#if __GLASGOW_HASKELL__ < 906
import GHC.Types.Error (MsgEnvelope(..))
import GHC.Utils.Error (mkPlainError)
#endif
#endif

#endif

#if __GLASGOW_HASKELL__ >= 906
-- import Language.Haskell.Syntax.Concrete (LayoutInfo(NoLayoutInfo))
#else
import GHC.Types.SrcLoc (LayoutInfo(NoLayoutInfo))
#endif

#if __GLASGOW_HASKELL__ >= 906
import GHC.Types.Error (UnknownDiagnostic(..),
DiagnosticReason(WarningWithoutFlag),
mkPlainDiagnostic)
import GHC.Driver.Config.Diagnostic (initPrintConfig)
import GHC.Utils.Error (mkMsgEnvelope)
#endif


{-------------------------------------------------------------------------------
Names
-------------------------------------------------------------------------------}
Expand Down Expand Up @@ -206,18 +225,26 @@ hscNameCacheIO = hsc_NC
-- | Optionally @qualified@ import declaration
importDecl :: Bool -> ModuleName -> LImportDecl GhcPs
importDecl qualified name = reLocA $ noLoc $ ImportDecl {
#if __GLASGOW_HASKELL__ >= 906
ideclExt = XImportDeclPass EpAnnNotUsed NoSourceText True
#else
ideclExt = defExt
, ideclSourceSrc = NoSourceText
#endif
, ideclName = reLocA $ noLoc name
#if __GLASGOW_HASKELL__ >= 904
, ideclPkgQual = NoRawPkgQual
#else
, ideclPkgQual = Nothing
#endif
, ideclSafe = False
#if __GLASGOW_HASKELL__ < 906
, ideclImplicit = False
#endif
, ideclAs = Nothing
#if __GLASGOW_HASKELL__ < 906
, ideclHiding = Nothing
#endif
#if __GLASGOW_HASKELL__ < 810
, ideclQualified = qualified
#else
Expand All @@ -227,6 +254,9 @@ importDecl qualified name = reLocA $ noLoc $ ImportDecl {
, ideclSource = False
#else
, ideclSource = NotBoot
#endif
#if __GLASGOW_HASKELL__ >= 906
, ideclImportList = Nothing
#endif
}

Expand All @@ -237,6 +267,16 @@ issueWarning l errMsg = do
logger <- getLogger
liftIO $ printOrThrowWarnings logger dynFlags . bag $
mkWarnMsg l neverQualify errMsg
#elif __GLASGOW_HASKELL__ >= 906
logger <- getLogger
let printOpts = initPrintConfig dynFlags
diagOpts = initDiagOpts dynFlags
liftIO $ printOrThrowDiagnostics logger printOpts diagOpts . mkMessages . bag $
mkMsgEnvelope
diagOpts
l
neverQualify
(GhcUnknownMessage $ UnknownDiagnostic $ mkPlainDiagnostic WarningWithoutFlag [] errMsg)
#elif __GLASGOW_HASKELL__ >= 904
logger <- getLogger
liftIO $ printOrThrowDiagnostics logger (initDiagOpts dynFlags) . mkMessages . bag $
Expand Down Expand Up @@ -277,7 +317,10 @@ instance HasDefaultExt NoExtField where
defExt = noExtField
#endif

#if __GLASGOW_HASKELL__ >= 900
#if __GLASGOW_HASKELL__ >= 906
instance HasDefaultExt (LayoutInfo pass) where
defExt = NoLayoutInfo
#elif __GLASGOW_HASKELL__ >= 900
instance HasDefaultExt LayoutInfo where
defExt = NoLayoutInfo
#endif
Expand Down Expand Up @@ -306,7 +349,9 @@ reLocA = id
mkLabel :: SrcSpan -> FastString -> LHsExpr GhcPs
mkLabel l n = reLocA $ L l
$ HsOverLabel defExt
#if __GLASGOW_HASKELL__ < 902
#if __GLASGOW_HASKELL__ >= 906
NoSourceText
#elif __GLASGOW_HASKELL__ < 902
Nothing
#endif
n
6 changes: 3 additions & 3 deletions large-generics/large-generics.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 2.4
name: large-generics
version: 0.2.1
version: 0.3.0
synopsis: Generic programming API for large-records and large-anon
description: The large-generics package offers a style of generic
programming inspired by generics-sop, but optimized for
Expand Down Expand Up @@ -42,8 +42,8 @@ library
hs-source-dirs:
src
build-depends:
base >= 4.13 && < 4.18
, aeson >= 1.4.4 && < 2.2
base >= 4.13 && < 4.19
, aeson >= 1.4.4 && < 2.3
, deepseq >= 1.4.4 && < 1.5
, generics-sop >= 0.5 && < 0.6
, sop-core >= 0.5 && < 0.6
Expand Down
Loading