on master help sign in
support building with GHC 8.6

resolves #230 # Conflicts: # project-m36.cabal # src/bin/ProjectM36/Server/WebSocket.hs # src/bin/TutorialD/Interpreter/Base.hs # src/bin/TutorialD/Interpreter/RelationalExpr.hs # src/bin/benchmark/Handles.hs

commit379bec368f77812e1b0aff850c5a93d14bb3a044 authorAgentM <agentm@themactionfaction.com> dateTue 28 Jan 2020, 10:25 (7 years ago) parent77541f0
8 files changed+63−15
cabal.project+7−1 project-m36.cabal+6−4 src/bin/ProjectM36/Server/WebSocket.hs+12−1 src/bin/TutorialD/Interpreter/Base.hs+12−2 src/bin/TutorialD/Interpreter/RelationalExpr.hs+4 src/bin/benchmark/Handles.hs+15−5 src/lib/ProjectM36/RelationalExpression.hs−1 src/lib/ProjectM36/ScriptSession.hs+7−1
cabal.project+7−1
@@ -1,3 +1,9 @@
11-- this is needed for GHC8 until distributed-process-extras is updated on Hackage with increased upper bounds
22packages: project-m36.cabal
3−allow-newer: distributed-process-extras:time,distributed-process-extras:binary,distributed-process-client-server:binary,distributed-process-client-server:time,distributed-process-async:time,distributed-process-async:binary
3+allow-newer: distributed-process-extras:time,distributed-process-extras:binary,distributed-process-client-server:binary,distributed-process-client-server:time,distributed-process-async:time,distributed-process-async:binary,distributed-process-extras:stm,distributed-process-extras:containers,network-transport-tcp:containers,distributed-process-client-server:stm,distributed-process-client-server:containers,distributed-process-async:stm,distributed-process-async:containers
4+
5+--necessary for GHC 8.6 support :/
6+source-repository-package
7+ type: git
8+ location: https://github.com/haskell-distributed/distributed-process.git
9+ tag: 660d554f6acd2dba8b605c84e8fa69e45708bc14
project-m36.cabal+6−4
@@ -29,7 +29,9 @@ Flag stack
2929 Default: False
3030
3131Library
32− Build-Depends: base>=4.8 && < 4.12, ghc >= 7.8 && < 8.5, ghc-paths, mtl, containers, unordered-containers, hashable, haskeline, directory, MonadRandom, random-shuffle, uuid >= 1.3.12, cassava >= 0.4.5.1 && < 0.6, text, bytestring, deepseq, deepseq-generics, vector, parallel, monad-parallel, exceptions, transformers, gnuplot, binary, filepath, zlib, directory, vector-binary-instances, temporary, stm, time, hashable-time, old-locale, rset, attoparsec, either, base64-bytestring, data-interval, extended-reals, network-transport, aeson >= 1.1, path-pieces, conduit, resourcet, http-api-data, semigroups, QuickCheck, quickcheck-instances, distributed-process-client-server >= 0.2.3, distributed-process >= 0.7.4, distributed-process-extras >= 0.3.2, distributed-process-async >= 0.2.4.1, network-transport-tcp >= 0.6.0, network-transport, list-t, stm-containers >= 0.2.15, foldl, optparse-applicative, Glob, cryptohash-sha256
32+ Build-Depends: base>=4.8 && < 4.13, ghc >= 8.2 && < 8.7, ghc-paths, mtl, containers, unordered-containers, hashable, haskeline, directory, MonadRandom, random-shuffle, uuid >= 1.3.12, cassava >= 0.4.5.1 && < 0.6, text, bytestring, deepseq, deepseq-generics, vector, parallel, monad-parallel, exceptions, transformers, gnuplot, binary, filepath, zlib, directory, vector-binary-instances, temporary, stm, time, hashable-time, old-locale, rset, attoparsec, either, base64-bytestring, data-interval, extended-reals, network-transport, aeson >= 1.1, path-pieces, conduit, resourcet, http-api-data, semigroups, QuickCheck, quickcheck-instances, distributed-process-client-server >= 0.2.3, distributed-process >= 0.7.4, distributed-process-extras >= 0.3.2, distributed-process-async >= 0.2.4.1, network-transport-tcp >= 0.6.0, network-transport, list-t, stm-containers >= 0.2.15, foldl, optparse-applicative, Glob, cryptohash-sha256
33+ if impl(ghc>= 8.6)
34+ Build-Depends: deferred-folds
3335 Exposed-Modules: ProjectM36.Error,
3436 ProjectM36.Transaction,
3537 ProjectM36.TransactionGraph,
@@ -128,7 +130,7 @@ Library
128130
129131Executable tutd
130132 Build-Depends: base >=4.8 && <5.0,
131− ghc >= 7.8 && < 8.5,
133+ ghc >= 7.8 && < 8.7,
132134 ghc-paths,
133135 project-m36,
134136 containers,
@@ -156,7 +158,7 @@ Executable tutd
156158 directory,
157159 filepath,
158160 temporary,
159− megaparsec >= 5.2.0 && < 7,
161+ megaparsec >= 5.2.0 && < 8,
160162 haskeline,
161163 random, MonadRandom,
162164 base64-bytestring,
@@ -191,7 +193,7 @@ Executable tutd
191193
192194Executable project-m36-server
193195 Build-Depends: base,
194− ghc >= 7.8 && < 8.5,
196+ ghc >= 7.8 && < 8.7,
195197 ghc-paths,
196198 project-m36,
197199 binary,
src/bin/ProjectM36/Server/WebSocket.hs+12−1
@@ -23,6 +23,10 @@ import Control.Applicative
2323import Text.Megaparsec.Error
2424import Data.Functor
2525
26+#if MIN_VERSION_megaparsec(7,0,0)
27+import Data.List.NonEmpty as NE
28+#endif
29+
2630websocketProxyServer :: Port -> Hostname -> WS.ServerApp
2731websocketProxyServer port host pending = do
2832 conn <- WS.acceptRequest pending
@@ -54,7 +58,14 @@ websocketProxyServer port host pending = do
5458 Left _ -> unexpectedMsg
5559 Right (presentation, tutdString) ->
5660 case parseTutorialD tutdString of
57− Left err -> handleOpResult conn dbconn presentation (DisplayErrorResult ("parse error: " `T.append` T.pack (parseErrorPretty err)))
61+ Left err -> handleOpResult conn dbconn presentation
62+#if MIN_VERSION_megaparsec(7,0,0)
63+ (DisplayErrorResult
64+ ("parse error: " `T.append` T.pack
65+ (parseErrorPretty . NE.head . bundleErrors $ err)))
66+#else
67+ (DisplayErrorResult ("parse error: " `T.append` T.pack (parseErrorPretty err)))
68+#endif
5869 Right parsed -> do
5970 let timeoutFilter exc = if exc == RequestTimeoutException
6071 then Just exc
src/bin/TutorialD/Interpreter/Base.hs+12−2
@@ -45,6 +45,11 @@ import Data.Time.Clock
4545import Data.Time.Format
4646import Control.Monad (void)
4747
48+#if !MIN_VERSION_megaparsec(7,0,0)
49+anySingle :: Parsec Void Text (Token Text)
50+anySingle = anyChar
51+#endif
52+
4853displayOpResult :: TutorialDOperatorResult -> IO ()
4954displayOpResult QuitResult = return ()
5055displayOpResult (DisplayResult out) = TIO.putStrLn out
@@ -57,8 +62,13 @@ displayOpResult (DisplayRelationResult rel) = do
5762 let randomlySortedRel = evalRand (randomizeTupleOrder rel) gen
5863 TIO.putStrLn (showRelation randomlySortedRel)
5964displayOpResult (DisplayParseErrorResult mPromptLength err) = do
60− let errString = T.pack (parseErrorPretty err)
61− errorIndent = unPos (sourceColumn (NE.head (errorPos err)))
65+#if MIN_VERSION_megaparsec(7,0,0)
66+ let errorIndent = errorOffset . NE.head . bundleErrors $ err
67+ errString = T.pack (parseErrorPretty . NE.head . bundleErrors $ err)
68+#else
69+ let errorIndent = unPos (sourceColumn (NE.head (errorPos err)))
70+ errString = T.pack (parseErrorPretty err)
71+#endif
6272 pointyString len = T.justifyRight (len + fromIntegral errorIndent) '_' "^"
6373 maybe (pure ()) (TIO.putStrLn . pointyString) mPromptLength
6474 TIO.putStr ("ERR:" <> errString)
src/bin/TutorialD/Interpreter/RelationalExpr.hs+4
@@ -1,6 +1,10 @@
11module TutorialD.Interpreter.RelationalExpr where
22import Text.Megaparsec
3+#if MIN_VERSION_megaparsec(7,0,0)
4+import Control.Monad.Combinators.Expr
5+#else
36import Text.Megaparsec.Expr
7+#endif
48import ProjectM36.Base
59import TutorialD.Interpreter.Base
610import TutorialD.Interpreter.Types
src/bin/benchmark/Handles.hs+15−5
@@ -62,8 +62,13 @@ runOpenClose tutdSetup' tutdIterate' tCount dbdir' = do
6262 res <- evalTutorialD session conn UnsafeEvaluation parsed
6363 case res of
6464 DisplayErrorResult err -> error (T.unpack err)
65− DisplayParseErrorResult _ err -> error (parseErrorPretty err)
66− _ -> do
65+ DisplayParseErrorResult _ err ->
66+#if MIN_VERSION_megaparsec(7,0,0)
67+ error (errorBundlePretty err)
68+#else
69+ error (parseErrorPretty err)
70+#endif
71+ _ -> do
6772 replicateM_ tCount (runTransaction tutdIterate' session conn)
6873 close conn
6974 printFdCount
@@ -77,9 +82,14 @@ runTransaction tutdIterate' sess conn =
7782 res <- evalTutorialD sess conn UnsafeEvaluation parsed
7883 case res of
7984 DisplayErrorResult err -> error (T.unpack err)
80− DisplayParseErrorResult _ err -> error (parseErrorPretty err)
81− _ -> do
82− eErr <- commit sess conn
85+ DisplayParseErrorResult _ err ->
86+#if MIN_VERSION_megaparsec(7,0,0)
87+ error (errorBundlePretty err)
88+#else
89+ error (parseErrorPretty err)
90+#endif
91+ _ -> do
92+ eErr <- commit sess conn
8393 case eErr of
8494 Left err -> error (show err)
8595 Right _ -> printFdCount
src/lib/ProjectM36/RelationalExpression.hs−1
@@ -536,7 +536,6 @@ evalGraphRefDatabaseContextExpr (RemoveTypeConstructor tConsName) = do
536536
537537evalGraphRefDatabaseContextExpr (MultipleExpr exprs) = do
538538 --the multiple expressions must pass the same context around- not the old unmodified context
539− ctx <- getContext
540539 mapM_ (\expr -> evalGraphRefDatabaseContextExpr expr) exprs
541540
542541evalGraphRefDatabaseContextExpr (RemoveAtomFunction funcName) = do
src/lib/ProjectM36/ScriptSession.hs+7−1
@@ -1,4 +1,7 @@
11{-# LANGUAGE MagicHash, UnboxedTuples #-}
2+#if MIN_VERSION_GLASGOW_HASKELL(8,6,0,0)
3+{-# LANGUAGE GADTs #-}
4+#endif
25module ProjectM36.ScriptSession where
36
47import ProjectM36.Error
@@ -124,6 +127,9 @@ initScriptSession ghcPkgPaths = do
124127 ideclSourceSrc = NoSourceText,
125128#else
126129 ideclSourceSrc = Nothing,
130+#endif
131+#if MIN_VERSION_GLASGOW_HASKELL(8,6,0,0)
132+ ideclExt = noExt,
127133#endif
128134 ideclName = noLoc mn,
129135 ideclPkgQual = Nothing,
@@ -244,4 +250,4 @@ prefixUnderscore =
244250 ("mingw32",_) -> "_"
245251 ("darwin",_) -> "_"
246252 ("cygwin",_) -> "_"
247− _ -> ""
253+ _ -> ""