-
Notifications
You must be signed in to change notification settings - Fork 30
Add GHC 9 support #84
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
Closed
Closed
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
cbdc5ee
Get it to build with GHC 9
AriFordsham 431d401
Add CI for GHC 9
AriFordsham eef89b5
Fixed CI
AriFordsham e618924
Fixed CI
AriFordsham bf3a112
Fixed CI
AriFordsham 36573d6
Fixed GHC 8
AriFordsham 397e675
Tweak CI
AriFordsham 2775576
Fixed test suites
AriFordsham 8cc1b68
Fixed GHC 8.6-8.8
AriFordsham a094e5e
Fix GHC 9 CI
AriFordsham 65b1f62
Reenable cache
AriFordsham e9d48c2
Merge branch 'ari-f-ghc-9' of https://github.com/AriFordsham/ghc-sour…
AriFordsham 684aacf
Get it to build with GHC 9
AriFordsham 4ffcc02
Fixed CI
AriFordsham 7df05e4
Fixed CI
AriFordsham e71dad9
Fixed GHC 8
AriFordsham 254999d
Fixed test suites
AriFordsham a0b3f7a
Fixed GHC 8.6-8.8
AriFordsham 9530599
Reenable cache
AriFordsham bf6a0c1
Fix 8.10 CI
AriFordsham 94fe33d
Fix CI typo
AriFordsham 268d4ef
Fixed broken tests
AriFordsham fd0842e
Added GHC upper bound
AriFordsham dea5e95
Remove allow-newer
AriFordsham 8f0b5ce
Fix broken imports
AriFordsham File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,14 +49,27 @@ module GHC.SourceGen.Decl | |
, patSynBind | ||
) where | ||
|
||
#if MIN_VERSION_ghc(9,0,1) | ||
import GHC.Types.Basic (LexicalFixity(Prefix)) | ||
import GHC.Data.Bag (listToBag) | ||
import GHC.Types.SrcLoc (Located, LayoutInfo(NoLayoutInfo)) | ||
import GHC.Parser.Annotation (IsUnicodeSyntax(NormalSyntax)) | ||
#else | ||
import BasicTypes (LexicalFixity(Prefix)) | ||
import Bag (listToBag) | ||
import SrcLoc (Located) | ||
#endif | ||
|
||
#if !MIN_VERSION_ghc(8,6,0) | ||
import BasicTypes (DerivStrategy(..)) | ||
#endif | ||
import Bag (listToBag) | ||
import GHC.Hs.Binds | ||
import GHC.Hs.Decls | ||
#if MIN_VERSION_ghc(9,0,1) | ||
import GHC.Hs.Type | ||
#else | ||
import GHC.Hs.Types | ||
#endif | ||
( ConDeclField(..) | ||
, FieldOcc(..) | ||
, HsConDetails(..) | ||
|
@@ -71,8 +84,11 @@ import GHC.Hs.Types | |
#endif | ||
, SrcStrictness(..) | ||
, SrcUnpackedness(..) | ||
#if MIN_VERSION_ghc(9,0,1) | ||
, HsScaled (HsScaled) | ||
, HsArrow (HsUnrestrictedArrow) | ||
#endif | ||
) | ||
import SrcLoc (Located) | ||
|
||
#if MIN_VERSION_ghc(8,10,0) | ||
import GHC.Hs.Extension (NoExtField(NoExtField)) | ||
|
@@ -148,14 +164,16 @@ funDep = ClassFunDep | |
class' | ||
:: [HsType'] -- ^ Context | ||
-> OccNameStr -- ^ Class name | ||
-> [HsTyVarBndr'] -- ^ Type parameters | ||
-> [HsTyVarBndrUnit'] -- ^ Type parameters | ||
-> [ClassDecl] -- ^ Class declarations | ||
-> HsDecl' | ||
class' context name vars decls | ||
= noExt TyClD $ ClassDecl | ||
{ tcdCtxt = builtLoc $ map builtLoc context | ||
#if MIN_VERSION_ghc(8,10,0) | ||
, tcdCExt = NoExtField | ||
#if MIN_VERSION_ghc(9,0,1) | ||
, tcdCExt = NoLayoutInfo | ||
#elif MIN_VERSION_ghc(8,10,0) | ||
, tcdCExt = NoExtField | ||
#elif MIN_VERSION_ghc(8,6,0) | ||
, tcdCExt = NoExt | ||
#else | ||
|
@@ -253,7 +271,7 @@ tyFamInst name params ty = tyFamInstD | |
-- > type A a b = B b a | ||
-- > ===== | ||
-- > type' "A" [bvar "a", bvar "b"] $ var "B" @@ var "b" @@ var "a" | ||
type' :: OccNameStr -> [HsTyVarBndr'] -> HsType' -> HsDecl' | ||
type' :: OccNameStr -> [HsTyVarBndrUnit'] -> HsType' -> HsDecl' | ||
type' name vars t = | ||
noExt TyClD $ withPlaceHolder $ noExt SynDecl (typeRdrName $ unqual name) | ||
(mkQTyVars vars) | ||
|
@@ -263,7 +281,7 @@ type' name vars t = | |
newOrDataType | ||
:: NewOrData | ||
-> OccNameStr | ||
-> [HsTyVarBndr'] | ||
-> [HsTyVarBndrUnit'] | ||
-> [ConDecl'] | ||
-> [HsDerivingClause'] | ||
-> HsDecl' | ||
|
@@ -285,7 +303,7 @@ newOrDataType newOrData name vars conDecls derivs | |
-- > newtype' "Const" [bvar "a", bvar "b"] | ||
-- > (conDecl "Const" [var "a"]) | ||
-- > [var "Show"] | ||
newtype' :: OccNameStr -> [HsTyVarBndr'] -> ConDecl' -> [HsDerivingClause'] -> HsDecl' | ||
newtype' :: OccNameStr -> [HsTyVarBndrUnit'] -> ConDecl' -> [HsDerivingClause'] -> HsDecl' | ||
newtype' name vars conD = newOrDataType NewType name vars [conD] | ||
|
||
-- | A data declaration. | ||
|
@@ -298,7 +316,7 @@ newtype' name vars conD = newOrDataType NewType name vars [conD] | |
-- > , conDecl "Right" [var "b"] | ||
-- > ] | ||
-- > [var "Show"] | ||
data' :: OccNameStr -> [HsTyVarBndr'] -> [ConDecl'] -> [HsDerivingClause'] -> HsDecl' | ||
data' :: OccNameStr -> [HsTyVarBndrUnit'] -> [ConDecl'] -> [HsDerivingClause'] -> HsDecl' | ||
data' = newOrDataType DataType | ||
|
||
-- | Declares a Haskell-98-style prefix constructor for a data or type | ||
|
@@ -308,8 +326,16 @@ data' = newOrDataType DataType | |
-- > ===== | ||
-- > conDecl "Foo" [field (var "a"), field (var "Int")] | ||
prefixCon :: OccNameStr -> [Field] -> ConDecl' | ||
prefixCon name fields = renderCon98Decl name | ||
$ PrefixCon $ map renderField fields | ||
prefixCon name fields = | ||
renderCon98Decl | ||
name | ||
$ PrefixCon | ||
#if MIN_VERSION_ghc(9,0,1) | ||
$ map (HsScaled (HsUnrestrictedArrow NormalSyntax) . renderField) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
#else | ||
$ map renderField | ||
#endif | ||
fields | ||
|
||
-- | Declares a Haskell-98-style infix constructor for a data or type | ||
-- declaration. | ||
|
@@ -319,7 +345,19 @@ prefixCon name fields = renderCon98Decl name | |
-- > infixCon (field (var "A" @@ var "b")) ":+:" (field (Var "C" @@ var "d")) | ||
infixCon :: Field -> OccNameStr -> Field -> ConDecl' | ||
infixCon f name f' = renderCon98Decl name | ||
$ InfixCon (renderField f) (renderField f') | ||
$ InfixCon | ||
( | ||
#if MIN_VERSION_ghc(9,0,1) | ||
HsScaled (HsUnrestrictedArrow NormalSyntax) $ | ||
#endif | ||
renderField f | ||
) | ||
( | ||
#if MIN_VERSION_ghc(9,0,1) | ||
HsScaled (HsUnrestrictedArrow NormalSyntax) $ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
#endif | ||
renderField f' | ||
) | ||
|
||
-- | Declares Haskell-98-style record constructor for a data or type | ||
-- declaration. | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't know if this is right