From e67e7af0f95f1877ef7c9683dbbe17579afaadd7 Mon Sep 17 00:00:00 2001 From: George Thomas Date: Tue, 1 Dec 2020 11:38:40 +0000 Subject: [PATCH] Update for GHC 8.10.2 --- .gitignore | 2 +- cspmchecker/cspmchecker.cabal | 19 +++++++++++++------ cspmchecker/src/Explorer/Main.hs | 2 +- cspmchecker/src/InteractiveChecker/Main.hs | 1 + hie.yaml | 19 +++++++++++++++++++ libcspm.cabal | 7 ++++--- profiler/profiler.cabal | 2 +- src/CSPM/Evaluator/Exceptions.hs | 2 +- src/CSPM/Evaluator/Expr.hs | 2 -- src/CSPM/Evaluator/Monad.hs | 9 +++++++-- src/CSPM/Evaluator/Profiler.hs | 2 ++ src/CSPM/Evaluator/ProfilerThunks.hs | 2 -- src/CSPM/Evaluator/ValuePrettyPrinter.hs | 4 +++- src/CSPM/Evaluator/Values.hs | 3 +-- src/CSPM/Parser/Exceptions.hs | 2 ++ src/CSPM/Parser/Monad.hs | 1 - src/CSPM/Parser/Tokens.hs | 2 ++ src/CSPM/PrettyPrinter.hs | 2 ++ src/CSPM/Renamer.hs | 2 ++ src/CSPM/Syntax/Names.hs | 2 ++ src/CSPM/TypeChecker/Decl.hs | 2 ++ src/CSPM/TypeChecker/Exceptions.hs | 2 +- src/CSPM/TypeChecker/Expr.hs | 2 ++ src/CSPM/TypeChecker/Monad.hs | 2 +- src/CSPM/TypeChecker/Pat.hs | 2 ++ src/Util/Annotated.hs | 2 +- src/Util/Exception.hs | 3 +++ src/Util/MonadicPrettyPrint.hs | 2 ++ src/Util/MonadicPrettyPrintInternal.hs | 2 ++ src/Util/PrettyPrint.hs | 2 ++ 30 files changed, 82 insertions(+), 26 deletions(-) create mode 100644 hie.yaml diff --git a/.gitignore b/.gitignore index ffae8c4..4041040 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ .DS_Store -dist +dist* cabal-dev diff --git a/cspmchecker/cspmchecker.cabal b/cspmchecker/cspmchecker.cabal index 7c39ad2..6add87c 100644 --- a/cspmchecker/cspmchecker.cabal +++ b/cspmchecker/cspmchecker.cabal @@ -25,7 +25,9 @@ Source-repository this Executable cspmchecker Main-is: Main.hs - Other-modules: Monad + Other-modules: + Monad + Paths_cspmchecker Extensions: DoAndIfThenElse @@ -40,7 +42,9 @@ Executable cspmchecker Executable cspmcheckeri Main-is: Main.hs - Other-modules: Monad + Other-modules: + Monad + Paths_cspmchecker Build-depends: base >= 4 && < 5, @@ -48,21 +52,24 @@ Executable cspmcheckeri filepath >= 1.2, mtl >= 2.0, directory >= 1.0, - haskeline >= 0.7 + haskeline >= 0.8, + exceptions >= 0.10 Hs-Source-Dirs: src/InteractiveChecker Executable cspmexplorer Main-is: Main.hs - Other-modules: Monad + Other-modules: + Paths_cspmchecker Build-depends: base >= 4 && < 5, - hashable >= 1.2 && < 1.3, + hashable >= 1.2 && < 1.4, hashtables >= 1.1 && < 1.3, libcspm, filepath >= 1.2, mtl >= 2.0, - directory >= 1.0 + directory >= 1.0, + deepseq >= 1.4 Hs-Source-Dirs: src/Explorer diff --git a/cspmchecker/src/Explorer/Main.hs b/cspmchecker/src/Explorer/Main.hs index fe04c1f..deebfc1 100644 --- a/cspmchecker/src/Explorer/Main.hs +++ b/cspmchecker/src/Explorer/Main.hs @@ -14,7 +14,7 @@ import System.FilePath import System.Exit import System.IO -import qualified Paths_cspmexplorer as C +import qualified Paths_cspmchecker as C import Data.Version (showVersion) import CSPM diff --git a/cspmchecker/src/InteractiveChecker/Main.hs b/cspmchecker/src/InteractiveChecker/Main.hs index efbca52..bb8bc15 100644 --- a/cspmchecker/src/InteractiveChecker/Main.hs +++ b/cspmchecker/src/InteractiveChecker/Main.hs @@ -2,6 +2,7 @@ module Main where import Data.Char import Control.Exception (AsyncException(..)) +import Control.Monad.Catch import Control.Monad.Trans import Data.List import Prelude hiding (catch) diff --git a/hie.yaml b/hie.yaml new file mode 100644 index 0000000..b00bc73 --- /dev/null +++ b/hie.yaml @@ -0,0 +1,19 @@ +cradle: + cabal: + - path: "src" + component: "lib:libcspm" + + - path: "cspmchecker/src/Checker" + component: "exe:cspmchecker" + + - path: "cspmchecker/src/Explorer" + component: "exe:cspmexplorer" + + - path: "cspmchecker/src/InteractiveChecker" + component: "exe:cspmcheckeri" + + - path: "profiler/src" + component: "exe:cspmprofiler" + + - path: "tests" + component: "libcspm:test:libcspm_tests" diff --git a/libcspm.cabal b/libcspm.cabal index 17a82be..33a6a96 100644 --- a/libcspm.cabal +++ b/libcspm.cabal @@ -45,12 +45,12 @@ Library array >= 0.4 && < 0.6, base >= 4.7 && < 5, bytestring >= 0.10 && < 0.11, - containers >= 0.5 && < 0.6, + containers >= 0.5 && < 0.7, deepseq >= 1.3 && < 1.5, directory >= 1.2 && < 1.4, - ghc-prim >= 0.3 && < 0.6, + ghc-prim >= 0.3 && < 0.7, filepath >= 1.3 && < 1.5, - hashable >= 1.2 && < 1.3, + hashable >= 1.3 && < 1.4, hashtables >= 1.1 && < 1.3, mtl >= 2.1 && < 2.3, pretty >= 1.1 && < 1.2, @@ -80,6 +80,7 @@ Library CSPM.Evaluator.PrefixExpr, CSPM.Evaluator.Profiler, CSPM.Evaluator.ProfilerThunks, + CSPM.Evaluator.ProfilerThunksTH, CSPM.Evaluator.Values, CSPM.Evaluator.ValueSet, CSPM.Evaluator.ValuePrettyPrinter, diff --git a/profiler/profiler.cabal b/profiler/profiler.cabal index 409eb2a..10d31e6 100644 --- a/profiler/profiler.cabal +++ b/profiler/profiler.cabal @@ -34,7 +34,7 @@ Executable cspmprofiler filepath >= 1.2, mtl >= 2.0, directory >= 1.0, - process >= 1.2 && < 1.3, + process >= 1.2 && < 1.7, temporary >= 1.2 && < 1.3 Hs-Source-Dirs: src diff --git a/src/CSPM/Evaluator/Exceptions.hs b/src/CSPM/Evaluator/Exceptions.hs index 931a2fd..b67fb3a 100644 --- a/src/CSPM/Evaluator/Exceptions.hs +++ b/src/CSPM/Evaluator/Exceptions.hs @@ -1,7 +1,7 @@ module CSPM.Evaluator.Exceptions where -import Prelude +import Prelude hiding ((<>)) import CSPM.Syntax.Names import CSPM.Syntax.AST diff --git a/src/CSPM/Evaluator/Expr.hs b/src/CSPM/Evaluator/Expr.hs index 70c5f64..7177163 100644 --- a/src/CSPM/Evaluator/Expr.hs +++ b/src/CSPM/Evaluator/Expr.hs @@ -29,8 +29,6 @@ import Util.Annotated import Util.Exception import Util.List -import CSPM.Prelude - -- In order to keep lazy evaluation working properly only use pattern -- matching when you HAVE to know the value. (Hence why we delay pattern -- matching in BooleanBinaryOp And in case the first value is false.) diff --git a/src/CSPM/Evaluator/Monad.hs b/src/CSPM/Evaluator/Monad.hs index 22952fa..f4c0856 100644 --- a/src/CSPM/Evaluator/Monad.hs +++ b/src/CSPM/Evaluator/Monad.hs @@ -1,3 +1,5 @@ +{-# LANGUAGE DerivingStrategies #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE CPP #-} module CSPM.Evaluator.Monad where @@ -11,7 +13,10 @@ import Util.Annotated import Util.Exception type EvaluationState = Environment -type EvaluationMonad = Reader EvaluationState +newtype EvaluationMonad a = EvaluationMonad (Reader EvaluationState a) + deriving newtype (Functor, Applicative, Monad, MonadReader EvaluationState) +instance MonadFail EvaluationMonad where + fail = error gets :: (EvaluationState -> a) -> EvaluationMonad a gets = asks @@ -20,7 +25,7 @@ modify :: (EvaluationState -> EvaluationState) -> EvaluationMonad a -> Evaluatio modify = local runEvaluator :: EvaluationState -> EvaluationMonad a -> a -runEvaluator st prog = runReader prog st +runEvaluator st (EvaluationMonad prog) = runReader prog st getState :: EvaluationMonad EvaluationState getState = gets id diff --git a/src/CSPM/Evaluator/Profiler.hs b/src/CSPM/Evaluator/Profiler.hs index 5df96bc..20438c6 100644 --- a/src/CSPM/Evaluator/Profiler.hs +++ b/src/CSPM/Evaluator/Profiler.hs @@ -30,6 +30,8 @@ module CSPM.Evaluator.Profiler ( profile, dumpProfilingData, ) where +import Prelude hiding ((<>)) + import Control.Monad.Trans import Data.Array.IArray import Data.Array.IO diff --git a/src/CSPM/Evaluator/ProfilerThunks.hs b/src/CSPM/Evaluator/ProfilerThunks.hs index 6eeace1..28060c0 100644 --- a/src/CSPM/Evaluator/ProfilerThunks.hs +++ b/src/CSPM/Evaluator/ProfilerThunks.hs @@ -7,9 +7,7 @@ module CSPM.Evaluator.ProfilerThunks ( ) where -import CSPM.Evaluator.ProfilerThunksTH import Data.Array -import Language.Haskell.TH #ifndef CSPM_PROFILING diff --git a/src/CSPM/Evaluator/ValuePrettyPrinter.hs b/src/CSPM/Evaluator/ValuePrettyPrinter.hs index 973c064..365434a 100644 --- a/src/CSPM/Evaluator/ValuePrettyPrinter.hs +++ b/src/CSPM/Evaluator/ValuePrettyPrinter.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE MonoLocalBinds #-} {-# LANGUAGE FlexibleContexts, FlexibleInstances, IncoherentInstances, MultiParamTypeClasses, ScopedTypeVariables, TypeSynonymInstances, UndecidableInstances #-} @@ -523,7 +524,8 @@ maybeNull' s _ | null (F.toList s) = M.text "SKIP" maybeNull' _ d = d instance - (M.MonadicPrettyPrintable m EventSet, + (Monad m, + M.MonadicPrettyPrintable m EventSet, M.MonadicPrettyPrintable m ValueSet) => M.MonadicPrettyPrintable m Proc where diff --git a/src/CSPM/Evaluator/Values.hs b/src/CSPM/Evaluator/Values.hs index 8c1bc06..878c157 100644 --- a/src/CSPM/Evaluator/Values.hs +++ b/src/CSPM/Evaluator/Values.hs @@ -30,7 +30,6 @@ import Prelude hiding (lookup) import CSPM.Evaluator.AnalyserMonad import CSPM.Evaluator.Monad -import CSPM.Evaluator.Environment import {-# SOURCE #-} qualified CSPM.Evaluator.ValueSet as S import {-# SOURCE #-} CSPM.Evaluator.ValuePrettyPrinter import CSPM.Syntax.Names @@ -153,7 +152,7 @@ noSave :: EvaluationMonad Value -> EvaluationMonad Value noSave prog = do --pn <- getParentScopeIdentifier return $ VThunk prog - -- $ modify + -- $ modify --(\ st -> st { --CSPM.Evaluator.Monad.parentScopeIdentifier = pn -- }) prog diff --git a/src/CSPM/Parser/Exceptions.hs b/src/CSPM/Parser/Exceptions.hs index 1ce747b..ff60ab6 100644 --- a/src/CSPM/Parser/Exceptions.hs +++ b/src/CSPM/Parser/Exceptions.hs @@ -22,6 +22,8 @@ module CSPM.Parser.Exceptions ( ) where +import Prelude hiding ((<>)) + import CSPM.Syntax.Names import CSPM.Syntax.AST import CSPM.Parser.Tokens diff --git a/src/CSPM/Parser/Monad.hs b/src/CSPM/Parser/Monad.hs index 2a70aa6..07a08c5 100644 --- a/src/CSPM/Parser/Monad.hs +++ b/src/CSPM/Parser/Monad.hs @@ -18,7 +18,6 @@ import Control.Exception import Control.Monad.State import qualified Data.ByteString.Char8 as B import qualified Data.Map as M -import Data.Maybe (isNothing) #if __GLASGOW_HASKELL__ < 705 import Prelude hiding (catch) #endif diff --git a/src/CSPM/Parser/Tokens.hs b/src/CSPM/Parser/Tokens.hs index 5129b88..aa9e7c8 100644 --- a/src/CSPM/Parser/Tokens.hs +++ b/src/CSPM/Parser/Tokens.hs @@ -3,6 +3,8 @@ module CSPM.Parser.Tokens ( ) where +import Prelude hiding ((<>)) + import qualified Data.ByteString as B import CSPM.Syntax.AST (Model(..)) diff --git a/src/CSPM/PrettyPrinter.hs b/src/CSPM/PrettyPrinter.hs index 3ec9937..12511ae 100644 --- a/src/CSPM/PrettyPrinter.hs +++ b/src/CSPM/PrettyPrinter.hs @@ -4,6 +4,8 @@ module CSPM.PrettyPrinter ( ) where +import Prelude hiding ((<>)) + import CSPM.Syntax.AST import Util.Annotated import Util.PrettyPrint diff --git a/src/CSPM/Renamer.hs b/src/CSPM/Renamer.hs index 2342b07..05e885f 100644 --- a/src/CSPM/Renamer.hs +++ b/src/CSPM/Renamer.hs @@ -17,6 +17,8 @@ module CSPM.Renamer ( getBoundNames, ) where +import Prelude hiding ((<>)) + import Control.Monad.State import qualified Data.ByteString.Char8 as B import Data.List diff --git a/src/CSPM/Syntax/Names.hs b/src/CSPM/Syntax/Names.hs index 3a00cbe..432e1f9 100644 --- a/src/CSPM/Syntax/Names.hs +++ b/src/CSPM/Syntax/Names.hs @@ -13,6 +13,8 @@ module CSPM.Syntax.Names ( isNameDataConstructor, ) where +import Prelude hiding ((<>)) + import Control.Monad.Trans import qualified Data.ByteString.Char8 as B import Data.Hashable diff --git a/src/CSPM/TypeChecker/Decl.hs b/src/CSPM/TypeChecker/Decl.hs index e1f4b1a..6d71c3e 100644 --- a/src/CSPM/TypeChecker/Decl.hs +++ b/src/CSPM/TypeChecker/Decl.hs @@ -1,6 +1,8 @@ {-# LANGUAGE FlexibleContexts, MultiParamTypeClasses, FlexibleInstances, TypeSynonymInstances #-} module CSPM.TypeChecker.Decl (typeCheckDecls) where +import Prelude hiding ((<>)) + import Control.Monad import Data.List (sort) import Data.Graph.Wrapper diff --git a/src/CSPM/TypeChecker/Exceptions.hs b/src/CSPM/TypeChecker/Exceptions.hs index 8c0bba3..44ba731 100644 --- a/src/CSPM/TypeChecker/Exceptions.hs +++ b/src/CSPM/TypeChecker/Exceptions.hs @@ -16,7 +16,7 @@ module CSPM.TypeChecker.Exceptions ( ) where -import Prelude +import Prelude hiding ((<>)) import Data.Maybe import Data.List (intersect, nub, sort) diff --git a/src/CSPM/TypeChecker/Expr.hs b/src/CSPM/TypeChecker/Expr.hs index f875a3c..1f9d03c 100644 --- a/src/CSPM/TypeChecker/Expr.hs +++ b/src/CSPM/TypeChecker/Expr.hs @@ -1,6 +1,8 @@ {-# LANGUAGE FlexibleContexts, MultiParamTypeClasses, FlexibleInstances, TypeSynonymInstances #-} module CSPM.TypeChecker.Expr () where +import Prelude hiding ((<>)) + import Control.Monad import Data.List diff --git a/src/CSPM/TypeChecker/Monad.hs b/src/CSPM/TypeChecker/Monad.hs index ad6aaba..ed78e88 100644 --- a/src/CSPM/TypeChecker/Monad.hs +++ b/src/CSPM/TypeChecker/Monad.hs @@ -39,7 +39,7 @@ import Control.Monad.State import Data.List ((\\)) import qualified Data.Map as M import qualified Data.Set as S -import Prelude hiding (lookup) +import Prelude hiding ((<>), lookup) import CSPM.Syntax.Names import CSPM.Syntax.Types diff --git a/src/CSPM/TypeChecker/Pat.hs b/src/CSPM/TypeChecker/Pat.hs index 81cc4bb..e64359f 100644 --- a/src/CSPM/TypeChecker/Pat.hs +++ b/src/CSPM/TypeChecker/Pat.hs @@ -1,6 +1,8 @@ {-# LANGUAGE MultiParamTypeClasses, FlexibleInstances, TypeSynonymInstances #-} module CSPM.TypeChecker.Pat () where +import Prelude hiding ((<>)) + import CSPM.Syntax.FreeVars import CSPM.Syntax.Names import CSPM.Syntax.AST hiding (getType) diff --git a/src/Util/Annotated.hs b/src/Util/Annotated.hs index db87bdd..0d35a78 100644 --- a/src/Util/Annotated.hs +++ b/src/Util/Annotated.hs @@ -4,7 +4,7 @@ module Util.Annotated where import qualified Data.ByteString as B import Data.Hashable import GHC.Generics (Generic) -import Prelude +import Prelude hiding ((<>)) import Util.Exception import Util.Prelude import Util.PrettyPrint diff --git a/src/Util/Exception.hs b/src/Util/Exception.hs index 5213203..f5ed10a 100644 --- a/src/Util/Exception.hs +++ b/src/Util/Exception.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE ConstrainedClassMethods #-} {-# LANGUAGE CPP, DeriveDataTypeable, FlexibleInstances, ScopedTypeVariables, TypeSynonymInstances #-} module Util.Exception ( @@ -19,6 +20,8 @@ import Data.List #if __GLASGOW_HASKELL__ < 705 import Prelude hiding (catch) +#else +import Prelude hiding ((<>)) #endif import {-# SOURCE #-} Util.Annotated diff --git a/src/Util/MonadicPrettyPrint.hs b/src/Util/MonadicPrettyPrint.hs index 5e5847b..49cd524 100644 --- a/src/Util/MonadicPrettyPrint.hs +++ b/src/Util/MonadicPrettyPrint.hs @@ -14,6 +14,8 @@ module Util.MonadicPrettyPrint( bytestring, ) where +import Prelude hiding ((<>)) + import qualified Data.ByteString.Char8 as B import Numeric import Util.MonadicPrettyPrintInternal diff --git a/src/Util/MonadicPrettyPrintInternal.hs b/src/Util/MonadicPrettyPrintInternal.hs index 04579b3..5302ea0 100644 --- a/src/Util/MonadicPrettyPrintInternal.hs +++ b/src/Util/MonadicPrettyPrintInternal.hs @@ -67,6 +67,8 @@ module Util.MonadicPrettyPrintInternal( fullRender, ) where +import Prelude hiding ((<>)) + import qualified Text.PrettyPrint.HughesPJ as P -------------------------------------------------------------------------------- diff --git a/src/Util/PrettyPrint.hs b/src/Util/PrettyPrint.hs index 3628e13..43c1f3e 100644 --- a/src/Util/PrettyPrint.hs +++ b/src/Util/PrettyPrint.hs @@ -12,6 +12,8 @@ module Util.PrettyPrint ( ) where +import Prelude hiding ((<>)) + import qualified Data.ByteString.Char8 as B import Numeric