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

[WIP] GHC 8.10.7 #1522

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
fail-fast: false
matrix:
versions:
- ghc: '8.6.5'
- ghc: '8.10.7'
cabal: '3.4'
steps:
- uses: actions/checkout@v2
Expand Down
3 changes: 3 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ packages:
codeworld-server/
codeworld-base/
funblocks-client/

constraints:
ghcjs-dom ==0.9.*
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather keep all the version constraints in one place. Can this be kept in the cabal file?

8 changes: 4 additions & 4 deletions codeworld-api/codeworld-api.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Library
mtl >= 2.2.1 && < 2.3,
random >= 1.1 && < 1.2,
ref-tf >= 0.4 && < 0.5,
reflex >= 0.6.3 && < 0.7,
reflex >= 0.6.3,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we need upper bounds on versions to upload to hackage. So feel free to relax bounds, but let's leave them in place for codeworld-api. Other packages don't need upper bounds, since they don't get released to hackage.

template-haskell >= 2.8 && < 2.18,
text >= 1.2.2 && < 1.3,
time >= 1.8 && < 2.0,
Expand All @@ -73,7 +73,7 @@ Library
ghcjs-prim,
codeworld-game-api,
codeworld-prediction,
ghcjs-dom >= 0.9 && < 0.9.4,
ghcjs-dom >= 0.9,
transformers
else
Build-depends: blank-canvas >= 0.6 && < 0.8,
Expand Down Expand Up @@ -122,7 +122,7 @@ Test-suite unit-tests
mtl >= 2.2.1 && < 2.3,
random >= 1.1 && < 1.2,
ref-tf >= 0.4 && < 0.5,
reflex >= 0.6.3 && < 0.7,
reflex >= 0.6.3,
template-haskell >= 2.8 && < 2.18,
text >= 1.2.2 && < 1.3,
time >= 1.8 && < 2.0,
Expand All @@ -134,7 +134,7 @@ Test-suite unit-tests
ghcjs-prim,
codeworld-game-api,
codeworld-prediction,
ghcjs-dom >= 0.9 && < 0.9.4,
ghcjs-dom >= 0.9,
transformers
else
Build-depends: blank-canvas >= 0.6 && < 0.8,
Expand Down
2 changes: 1 addition & 1 deletion codeworld-base/src/Parameter.hs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import qualified CodeWorld.Parameter as CW
import Internal.Picture
import Internal.Text
import Prelude
import "base" Prelude ((.), map)
import "base" Prelude (map, (.))

-- | A drawing that depends on parameters. The first argument is a
-- list of parameters. The second is a picture, which depends on the
Expand Down
8 changes: 5 additions & 3 deletions codeworld-compiler/codeworld-compiler.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,18 @@ Library
directory,
exceptions,
filepath,
ghc == 8.6.5,
ghc-boot-th == 8.6.5,
ghc == 8.10.*,
ghc-boot,
ghc-boot-th == 8.10.*,
ghc-lib-parser,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see where this is used.

If it's needed, ghc-lib-parser changes dramatically between versions (it's just a copy of parts of ghc), so it needs version bounds. But it would be better to leave it out and update the ghc code, if it's not too difficult.

hashable,
haskell-src-exts >= 1.20,
megaparsec >= 7.0.0 && < 8.0.0,
memory,
mtl,
process,
regex-base,
regex-tdfa,
regex-tdfa-text,
split,
syb,
temporary,
Expand Down
93 changes: 81 additions & 12 deletions codeworld-compiler/src/CodeWorld/Compile/Framework.hs
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,22 @@ import qualified "ghc" FastString as GHC
import qualified "ghc" Fingerprint as GHC
import qualified "ghc-boot-th" GHC.LanguageExtensions.Type as GHC
import qualified "ghc" HeaderInfo as GHC
import qualified "ghc" HsExtension as GHC
import qualified "ghc" HsSyn as GHC
import qualified "ghc" GHC.Hs.Extension as GHC
import qualified "ghc" GHC.Hs as GHC
import qualified "ghc" RdrHsSyn as GHC
import qualified "ghc" TcHsSyn as GHC
import qualified "ghc" HscTypes as GHC
import Language.Haskell.Exts
import qualified "ghc" Lexer as GHC
import qualified "ghc" Fingerprint as GHC
import qualified "ghc" Module as GHC
import qualified "ghc" Outputable as GHC
import qualified "ghc" Panic as GHC
import qualified "ghc" Parser as GHC
import qualified "ghc" Platform as GHC
import qualified "ghc" GhcNameVersion as GHC
import qualified "ghc" FileSettings as GHC
import qualified "ghc" ToolSettings as GHC
import qualified "ghc-boot" GHC.Platform as GHC
import qualified "ghc" SrcLoc as GHC
import qualified "ghc" StringBuffer as GHC
import System.Directory
Expand Down Expand Up @@ -305,32 +311,95 @@ ghcParseCode extraExts src = do
state = GHC.mkPState dflagsWithPragmas buffer location
return $ case GHC.unP GHC.parseModule state of
GHC.POk _ (GHC.L _ mod) -> GHCParsed mod
GHC.PFailed _ _ _ -> GHCNoParse
GHC.PFailed _ -> GHCNoParse

fakeDynFlags :: GHC.DynFlags
fakeDynFlags = GHC.defaultDynFlags fakeSettings fakeLlvmConfig

fakePlatformMisc :: GHC.PlatformMisc
fakePlatformMisc = GHC.PlatformMisc
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I almost cringe to ask it, but can you include field names here so the reader has some hope of finding what they need to change in the future?

mempty
mempty
GHC.IntegerSimple
False
False
False
mempty
False
False
False
False
False
False
mempty

fakeToolSettings :: GHC.ToolSettings
fakeToolSettings = GHC.ToolSettings
True
True
True
True
True
mempty
mempty
mempty
mempty
mempty
mempty
mempty
mempty
mempty
mempty
mempty
mempty
mempty
mempty
mempty
mempty
mempty
mempty
mempty
mempty
mempty
(GHC.Fingerprint (read mempty) (read mempty))
mempty
mempty
mempty
mempty
mempty
mempty
mempty
mempty
mempty
mempty
mempty
mempty

fakeSettings :: GHC.Settings
fakeSettings =
GHC.Settings
{ GHC.sProgramName = "ghcjs",
GHC.sProjectVersion = GHC.cProjectVersion,
{ GHC.sGhcNameVersion = GHC.GhcNameVersion "foo" "foo",
GHC.sFileSettings = GHC.FileSettings mempty mempty Nothing mempty mempty mempty,
GHC.sToolSettings = fakeToolSettings,
GHC.sTargetPlatform =
GHC.Platform
{ GHC.platformWordSize = 8,
GHC.platformOS = GHC.OSUnknown,
GHC.platformUnregisterised = True
{ GHC.platformWordSize = GHC.PW8,
GHC.platformMini = GHC.PlatformMini GHC.ArchX86_64 GHC.OSUnknown,
GHC.platformUnregisterised = True,
GHC.platformHasGnuNonexecStack = True,
GHC.platformIsCrossCompiling = True,
GHC.platformHasSubsectionsViaSymbols = True
},
GHC.sPlatformConstants =
GHC.PlatformConstants
{ GHC.pc_DYNAMIC_BY_DEFAULT = False,
GHC.pc_WORD_SIZE = 8
},
GHC.sOpt_P_fingerprint = GHC.fingerprint0
GHC.sPlatformMisc = fakePlatformMisc
}

fakeLlvmConfig :: (GHC.LlvmTargets, GHC.LlvmPasses)
fakeLlvmConfig = ([], [])
fakeLlvmConfig :: GHC.LlvmConfig
fakeLlvmConfig = GHC.LlvmConfig mempty mempty

parsePragmasIntoDynFlags ::
GHC.DynFlags ->
Expand Down
27 changes: 24 additions & 3 deletions codeworld-compiler/src/CodeWorld/Compile/Requirements/Eval.hs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,27 @@ import Data.Hashable
import Data.List
import qualified Data.Text as T
import Data.Void
import "ghc" HsSyn
import "ghc" GHC.Hs
( GRHS (..),
GRHSs (..),
GhcPs,
GhciLStmt,
HsBind,
HsBindLR (..),
HsExpr (HsApp, HsLet, HsPar, HsVar),
HsModule (..),
ImportDecl,
LHsDecl,
LHsExpr,
LMatch,
Match (..),
MatchGroup (..),
Sig (TypeSig),
pprFunBind,
pprPatBind,
)
import "ghc" GHC.Hs.Decls
import "ghc" GHC.Hs.Pat
import qualified Language.Haskell.Exts as Exts
import "ghc" Outputable
import "ghc" SrcLoc
Expand Down Expand Up @@ -192,8 +212,9 @@ checkRule (AllOf rules) = do
return (concat <$> results)
checkRule (AnyOf rules) = do
results <- sequence <$> mapM checkRule rules
return $ (<$> results) $ \errs ->
if any null errs then [] else ["No alternatives succeeded."]
return $
(<$> results) $ \errs ->
if any null errs then [] else ["No alternatives succeeded."]
checkRule (NotThis rule) = do
result <- checkRule rule
case result of
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ import Data.Generics
import Data.Generics.Twins
import Data.List
import Data.Maybe
import "ghc" HsSyn
import "ghc" RdrHsSyn
import "ghc" GHC.Hs
import "ghc" OccName
import "ghc" RdrName
import "ghc" SrcLoc
Expand Down
2 changes: 1 addition & 1 deletion codeworld-compiler/src/CodeWorld/Compile/Stages.hs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import Data.Monoid
import Data.Text (Text, unpack)
import Data.Text.Encoding (decodeUtf8)
import qualified "ghc" FastString as GHC
import qualified "ghc" HsSyn as GHC
import qualified "ghc" GHC.Hs as GHC
import Language.Haskell.Exts
import qualified "ghc" Module as GHC
import qualified "ghc" OccName as GHC
Expand Down
6 changes: 2 additions & 4 deletions codeworld-error-sanitizer/codeworld-error-sanitizer.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ Library
else
Build-depends: array,
regex-base,
regex-tdfa,
regex-tdfa-text
regex-tdfa

Default-language: Haskell2010
Exposed: True
Expand All @@ -49,7 +48,6 @@ Test-suite unit-tests
else
Build-depends: array,
regex-base,
regex-tdfa,
regex-tdfa-text
regex-tdfa

Default-language: Haskell2010
2 changes: 1 addition & 1 deletion codeworld-requirements/codeworld-requirements.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ library
haskell-src-exts >= 1.20,
mtl,
process,
regex-base,
regex-tdfa,
regex-tdfa-text,
syb,
temporary,
text,
Expand Down
2 changes: 1 addition & 1 deletion codeworld-server/codeworld-server.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Executable codeworld-server
fast-logger,
filelock,
filepath,
haskell-src-exts < 1.21,
haskell-src-exts,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I looked up the history, and this was originally added to keep hindent working, but CodeWorld now uses Ormolu instead of hindent, so dropping the restriction is fine.

http-conduit,
lifted-base,
memory,
Expand Down