on master help sign in
support building with GHC 8.6
379bec3AgentM
cabal.project+7−1
@@ -1,3 +1,9 @@
1-- this is needed for GHC8 until distributed-process-extras is updated on Hackage with increased upper bounds
1-- this is needed for GHC8 until distributed-process-extras is updated on Hackage with increased upper bounds
2packages: project-m36.cabal
2packages: 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
29 Default: False
29 Default: False
30
30
31Library
31Library
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
33 Exposed-Modules: ProjectM36.Error,
35 Exposed-Modules: ProjectM36.Error,
34 ProjectM36.Transaction,
36 ProjectM36.Transaction,
35 ProjectM36.TransactionGraph,
37 ProjectM36.TransactionGraph,
@@ -128,7 +130,7 @@ Library
128
130
129Executable tutd
131Executable tutd
130 Build-Depends: base >=4.8 && <5.0,
132 Build-Depends: base >=4.8 && <5.0,
131− ghc >= 7.8 && < 8.5,
133+ ghc >= 7.8 && < 8.7,
132 ghc-paths,
134 ghc-paths,
133 project-m36,
135 project-m36,
134 containers,
136 containers,
@@ -156,7 +158,7 @@ Executable tutd
156 directory,
158 directory,
157 filepath,
159 filepath,
158 temporary,
160 temporary,
159− megaparsec >= 5.2.0 && < 7,
161+ megaparsec >= 5.2.0 && < 8,
160 haskeline,
162 haskeline,
161 random, MonadRandom,
163 random, MonadRandom,
162 base64-bytestring,
164 base64-bytestring,
@@ -191,7 +193,7 @@ Executable tutd
191
193
192Executable project-m36-server
194Executable project-m36-server
193 Build-Depends: base,
195 Build-Depends: base,
194− ghc >= 7.8 && < 8.5,
196+ ghc >= 7.8 && < 8.7,
195 ghc-paths,
197 ghc-paths,
196 project-m36,
198 project-m36,
197 binary,
199 binary,
src/bin/ProjectM36/Server/WebSocket.hs+12−1
@@ -23,6 +23,10 @@ import Control.Applicative
23import Text.Megaparsec.Error
23import Text.Megaparsec.Error
24import Data.Functor
24import Data.Functor
25
25
26+#if MIN_VERSION_megaparsec(7,0,0)
27+import Data.List.NonEmpty as NE
28+#endif
29+
26websocketProxyServer :: Port -> Hostname -> WS.ServerApp
30websocketProxyServer :: Port -> Hostname -> WS.ServerApp
27websocketProxyServer port host pending = do
31websocketProxyServer port host pending = do
28 conn <- WS.acceptRequest pending
32 conn <- WS.acceptRequest pending
@@ -54,7 +58,14 @@ websocketProxyServer port host pending = do
54 Left _ -> unexpectedMsg
58 Left _ -> unexpectedMsg
55 Right (presentation, tutdString) ->
59 Right (presentation, tutdString) ->
56 case parseTutorialD tutdString of
60 case parseTutorialD tutdString of
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
57− Left err -> handleOpResult conn dbconn presentation (DisplayErrorResult ("parse error: " `T.append` T.pack (parseErrorPretty err)))
67+ (DisplayErrorResult ("parse error: " `T.append` T.pack (parseErrorPretty err)))
68+#endif
58 Right parsed -> do
69 Right parsed -> do
59 let timeoutFilter exc = if exc == RequestTimeoutException
70 let timeoutFilter exc = if exc == RequestTimeoutException
60 then Just exc
71 then Just exc
src/bin/TutorialD/Interpreter/Base.hs+12−2
@@ -45,6 +45,11 @@ import Data.Time.Clock
45import Data.Time.Format
45import Data.Time.Format
46import Control.Monad (void)
46import Control.Monad (void)
47
47
48+#if !MIN_VERSION_megaparsec(7,0,0)
49+anySingle :: Parsec Void Text (Token Text)
50+anySingle = anyChar
51+#endif
52+
48displayOpResult :: TutorialDOperatorResult -> IO ()
53displayOpResult :: TutorialDOperatorResult -> IO ()
49displayOpResult QuitResult = return ()
54displayOpResult QuitResult = return ()
50displayOpResult (DisplayResult out) = TIO.putStrLn out
55displayOpResult (DisplayResult out) = TIO.putStrLn out
@@ -57,8 +62,13 @@ displayOpResult (DisplayRelationResult rel) = do
57 let randomlySortedRel = evalRand (randomizeTupleOrder rel) gen
62 let randomlySortedRel = evalRand (randomizeTupleOrder rel) gen
58 TIO.putStrLn (showRelation randomlySortedRel)
63 TIO.putStrLn (showRelation randomlySortedRel)
59displayOpResult (DisplayParseErrorResult mPromptLength err) = do
64displayOpResult (DisplayParseErrorResult mPromptLength err) = do
65+#if MIN_VERSION_megaparsec(7,0,0)
66+ let errorIndent = errorOffset . NE.head . bundleErrors $ err
60− let errString = T.pack (parseErrorPretty err)
67+ errString = T.pack (parseErrorPretty . NE.head . bundleErrors $ err)
68+#else
61− errorIndent = unPos (sourceColumn (NE.head (errorPos err)))
69+ let errorIndent = unPos (sourceColumn (NE.head (errorPos err)))
70+ errString = T.pack (parseErrorPretty err)
71+#endif
62 pointyString len = T.justifyRight (len + fromIntegral errorIndent) '_' "^"
72 pointyString len = T.justifyRight (len + fromIntegral errorIndent) '_' "^"
63 maybe (pure ()) (TIO.putStrLn . pointyString) mPromptLength
73 maybe (pure ()) (TIO.putStrLn . pointyString) mPromptLength
64 TIO.putStr ("ERR:" <> errString)
74 TIO.putStr ("ERR:" <> errString)
src/bin/TutorialD/Interpreter/RelationalExpr.hs+4
@@ -1,6 +1,10 @@
1module TutorialD.Interpreter.RelationalExpr where
1module TutorialD.Interpreter.RelationalExpr where
2import Text.Megaparsec
2import Text.Megaparsec
3+#if MIN_VERSION_megaparsec(7,0,0)
4+import Control.Monad.Combinators.Expr
5+#else
3import Text.Megaparsec.Expr
6import Text.Megaparsec.Expr
7+#endif
4import ProjectM36.Base
8import ProjectM36.Base
5import TutorialD.Interpreter.Base
9import TutorialD.Interpreter.Base
6import TutorialD.Interpreter.Types
10import TutorialD.Interpreter.Types
src/bin/benchmark/Handles.hs+15−5
@@ -62,8 +62,13 @@ runOpenClose tutdSetup' tutdIterate' tCount dbdir' = do
62 res <- evalTutorialD session conn UnsafeEvaluation parsed
62 res <- evalTutorialD session conn UnsafeEvaluation parsed
63 case res of
63 case res of
64 DisplayErrorResult err -> error (T.unpack err)
64 DisplayErrorResult err -> error (T.unpack err)
65− DisplayParseErrorResult _ err -> error (parseErrorPretty err)
65+ DisplayParseErrorResult _ err ->
66+#if MIN_VERSION_megaparsec(7,0,0)
67+ error (errorBundlePretty err)
68+#else
69+ error (parseErrorPretty err)
70+#endif
66− _ -> do
71+ _ -> do
67 replicateM_ tCount (runTransaction tutdIterate' session conn)
72 replicateM_ tCount (runTransaction tutdIterate' session conn)
68 close conn
73 close conn
69 printFdCount
74 printFdCount
@@ -77,9 +82,14 @@ runTransaction tutdIterate' sess conn =
77 res <- evalTutorialD sess conn UnsafeEvaluation parsed
82 res <- evalTutorialD sess conn UnsafeEvaluation parsed
78 case res of
83 case res of
79 DisplayErrorResult err -> error (T.unpack err)
84 DisplayErrorResult err -> error (T.unpack err)
80− DisplayParseErrorResult _ err -> error (parseErrorPretty err)
85+ DisplayParseErrorResult _ err ->
86+#if MIN_VERSION_megaparsec(7,0,0)
87+ error (errorBundlePretty err)
88+#else
89+ error (parseErrorPretty err)
90+#endif
81− _ -> do
91+ _ -> do
82− eErr <- commit sess conn
92+ eErr <- commit sess conn
83 case eErr of
93 case eErr of
84 Left err -> error (show err)
94 Left err -> error (show err)
85 Right _ -> printFdCount
95 Right _ -> printFdCount
src/lib/ProjectM36/RelationalExpression.hs−1
@@ -536,7 +536,6 @@ evalGraphRefDatabaseContextExpr (RemoveTypeConstructor tConsName) = do
536
536
537evalGraphRefDatabaseContextExpr (MultipleExpr exprs) = do
537evalGraphRefDatabaseContextExpr (MultipleExpr exprs) = do
538 --the multiple expressions must pass the same context around- not the old unmodified context
538 --the multiple expressions must pass the same context around- not the old unmodified context
539− ctx <- getContext
540 mapM_ (\expr -> evalGraphRefDatabaseContextExpr expr) exprs
539 mapM_ (\expr -> evalGraphRefDatabaseContextExpr expr) exprs
541
540
542evalGraphRefDatabaseContextExpr (RemoveAtomFunction funcName) = do
541evalGraphRefDatabaseContextExpr (RemoveAtomFunction funcName) = do
src/lib/ProjectM36/ScriptSession.hs+7−1
@@ -1,4 +1,7 @@
1{-# LANGUAGE MagicHash, UnboxedTuples #-}
1{-# LANGUAGE MagicHash, UnboxedTuples #-}
2+#if MIN_VERSION_GLASGOW_HASKELL(8,6,0,0)
3+{-# LANGUAGE GADTs #-}
4+#endif
2module ProjectM36.ScriptSession where
5module ProjectM36.ScriptSession where
3
6
4import ProjectM36.Error
7import ProjectM36.Error
@@ -124,6 +127,9 @@ initScriptSession ghcPkgPaths = do
124 ideclSourceSrc = NoSourceText,
127 ideclSourceSrc = NoSourceText,
125#else
128#else
126 ideclSourceSrc = Nothing,
129 ideclSourceSrc = Nothing,
130+#endif
131+#if MIN_VERSION_GLASGOW_HASKELL(8,6,0,0)
132+ ideclExt = noExt,
127#endif
133#endif
128 ideclName = noLoc mn,
134 ideclName = noLoc mn,
129 ideclPkgQual = Nothing,
135 ideclPkgQual = Nothing,
@@ -244,4 +250,4 @@ prefixUnderscore =
244 ("mingw32",_) -> "_"
250 ("mingw32",_) -> "_"
245 ("darwin",_) -> "_"
251 ("darwin",_) -> "_"
246 ("cygwin",_) -> "_"
252 ("cygwin",_) -> "_"
247− _ -> ""
253+ _ -> ""