on master help sign in
Compatibility with GHC 8.8 and Cabal 3.0
1dd9316Niklas Larsson
idris.cabal+6−5
@@ -100,7 +100,7 @@ source-repository head
100
100
101custom-setup
101custom-setup
102 setup-depends:
102 setup-depends:
103− Cabal >= 1.10 && <2.5,
103+ Cabal >= 1.10 && < 3.1,
104 base >= 4 && <5,
104 base >= 4 && <5,
105 directory,
105 directory,
106 filepath,
106 filepath,
@@ -280,7 +280,7 @@ Library
280 , blaze-html >= 0.6.1.3 && < 0.10
280 , blaze-html >= 0.6.1.3 && < 0.10
281 , blaze-markup >= 0.5.2.1 && < 0.9
281 , blaze-markup >= 0.5.2.1 && < 0.9
282 , bytestring < 0.11
282 , bytestring < 0.11
283− , cheapskate >= 0.1.1 && < 0.2
283+ , cheapskate >= 0.1.1.2 && < 0.2
284 , code-page >= 0.1 && < 0.3
284 , code-page >= 0.1 && < 0.3
285 , containers >= 0.5 && < 0.7
285 , containers >= 0.5 && < 0.7
286 , deepseq < 1.5
286 , deepseq < 1.5
@@ -292,7 +292,7 @@ Library
292 , megaparsec >= 7.0.4 && < 8
292 , megaparsec >= 7.0.4 && < 8
293 , mtl >= 2.1 && < 2.3
293 , mtl >= 2.1 && < 2.3
294 , network >= 2.7 && < 2.9
294 , network >= 2.7 && < 2.9
295− , optparse-applicative >= 0.13 && < 0.15
295+ , optparse-applicative >= 0.13 && < 0.16
296 , parser-combinators >= 1.0.0
296 , parser-combinators >= 1.0.0
297 , pretty < 1.2
297 , pretty < 1.2
298 , process < 1.7
298 , process < 1.7
@@ -300,8 +300,8 @@ Library
300 , safe >= 0.3.9
300 , safe >= 0.3.9
301 , split < 0.3
301 , split < 0.3
302 , terminal-size < 0.4
302 , terminal-size < 0.4
303− , text >=1.2.1.0 && < 1.3
303+ , text >=1.2.1.0 && < 1.4
304− , time >= 1.4 && < 1.9
304+ , time >= 1.4 && < 2.0
305 , transformers >= 0.5 && < 0.6
305 , transformers >= 0.5 && < 0.6
306 , uniplate >=1.6 && < 1.7
306 , uniplate >=1.6 && < 1.7
307 , unordered-containers < 0.3
307 , unordered-containers < 0.3
@@ -314,6 +314,7 @@ Library
314
314
315 if !impl(ghc >= 8.0)
315 if !impl(ghc >= 8.0)
316 Build-Depends: semigroups == 0.18.*
316 Build-Depends: semigroups == 0.18.*
317+ , fail == 4.9.0.*
317
318
318 Default-Language: Haskell2010
319 Default-Language: Haskell2010
319 ghc-prof-options: -auto-all -caf-all
320 ghc-prof-options: -auto-all -caf-all
src/Idris/CmdOptions.hs+3−2
@@ -18,6 +18,7 @@ import Idris.Info (getIdrisVersion)
18import Idris.Options
18import Idris.Options
19import IRTS.CodegenCommon
19import IRTS.CodegenCommon
20
20
21+import qualified Control.Monad.Fail as Fail
21import Control.Monad.Trans (lift)
22import Control.Monad.Trans (lift)
22import Control.Monad.Trans.Except (throwE)
23import Control.Monad.Trans.Except (throwE)
23import Control.Monad.Trans.Reader (ask)
24import Control.Monad.Trans.Reader (ask)
@@ -264,7 +265,7 @@ parseCodegen :: String -> Codegen
264parseCodegen "bytecode" = Bytecode
265parseCodegen "bytecode" = Bytecode
265parseCodegen cg = Via IBCFormat (map toLower cg)
266parseCodegen cg = Via IBCFormat (map toLower cg)
266
267
267−parseLogCats :: Monad m => String -> m [LogCat]
268+parseLogCats :: Fail.MonadFail m => String -> m [LogCat]
268parseLogCats s =
269parseLogCats s =
269 case lastMay (readP_to_S doParse s) of
270 case lastMay (readP_to_S doParse s) of
270 Just (xs, _) -> return xs
271 Just (xs, _) -> return xs
@@ -290,7 +291,7 @@ parseLogCats s =
290 s <- look
291 s <- look
291 fail $ "Category: " ++ s ++ " is not recognised."
292 fail $ "Category: " ++ s ++ " is not recognised."
292
293
293−parseConsoleWidth :: Monad m => String -> m ConsoleWidth
294+parseConsoleWidth :: Fail.MonadFail m => String -> m ConsoleWidth
294parseConsoleWidth "auto" = return AutomaticWidth
295parseConsoleWidth "auto" = return AutomaticWidth
295parseConsoleWidth "infinite" = return InfinitelyWide
296parseConsoleWidth "infinite" = return InfinitelyWide
296parseConsoleWidth s =
297parseConsoleWidth s =
src/Idris/Core/CaseTree.hs+1−1
@@ -627,7 +627,7 @@ groupCons cs = gc [] cs
627 PConst cval -> return $ addConG cval (ps, res) acc
627 PConst cval -> return $ addConG cval (ps, res) acc
628 PSuc n -> return $ addg False CSuc [n] (ps, res) acc
628 PSuc n -> return $ addg False CSuc [n] (ps, res) acc
629 PReflected fn args -> return $ addg False (CFn fn) args (ps, res) acc
629 PReflected fn args -> return $ addg False (CFn fn) args (ps, res) acc
630− pat -> fail $ show pat ++ " is not a constructor or constant (can't happen)"
630+ pat -> error $ show pat ++ " is not a constructor or constant (can't happen)"
631
631
632 addg uniq c conargs res []
632 addg uniq c conargs res []
633 = [ConGroup uniq c [(conargs, res)]]
633 = [ConGroup uniq c [(conargs, res)]]
src/Idris/Core/TT.hs+6
@@ -70,6 +70,7 @@ import qualified Prelude as S (Semigroup(..))
70import Control.Applicative (Alternative, Applicative(..))
70import Control.Applicative (Alternative, Applicative(..))
71import qualified Control.Applicative as A (Alternative(..))
71import qualified Control.Applicative as A (Alternative(..))
72import Control.DeepSeq (($!!))
72import Control.DeepSeq (($!!))
73+import qualified Control.Monad.Fail as Fail
73import Control.Monad.State.Strict
74import Control.Monad.State.Strict
74import Data.Binary hiding (get, put)
75import Data.Binary hiding (get, put)
75import Data.Char
76import Data.Char
@@ -324,6 +325,11 @@ bindTC x k = case x of
324instance Monad TC where
325instance Monad TC where
325 return x = OK x
326 return x = OK x
326 x >>= k = bindTC x k
327 x >>= k = bindTC x k
328+#if !(MIN_VERSION_base(4,12,0))
329+ fail = Fail.fail
330+#endif
331+
332+instance Fail.MonadFail TC where
327 fail e = Error (InternalMsg e)
333 fail e = Error (InternalMsg e)
328
334
329instance MonadPlus TC where
335instance MonadPlus TC where
src/Idris/Parser/Stack.hs+2−1
@@ -36,6 +36,7 @@ import Idris.Core.TT (FC(..))
36import Idris.Output (Message(..))
36import Idris.Output (Message(..))
37
37
38import Control.Arrow (app)
38import Control.Arrow (app)
39+import qualified Control.Monad.Fail as Fail
39import Control.Monad.State.Strict (StateT(..), evalStateT)
40import Control.Monad.State.Strict (StateT(..), evalStateT)
40import Control.Monad.Writer.Strict (MonadWriter(..), WriterT(..), listen,
41import Control.Monad.Writer.Strict (MonadWriter(..), WriterT(..), listen,
41 runWriterT, tell)
42 runWriterT, tell)
@@ -51,7 +52,7 @@ import qualified Util.Pretty as PP
51type Parser s = StateT s (WriterT FC (P.Parsec Void String))
52type Parser s = StateT s (WriterT FC (P.Parsec Void String))
52
53
53-- | A constraint for parsing without state
54-- | A constraint for parsing without state
54−type Parsing m = (P.MonadParsec Void String m, MonadWriter FC m)
55+type Parsing m = (Fail.MonadFail m, P.MonadParsec Void String m, MonadWriter FC m)
55
56
56-- | Run the Idris parser stack
57-- | Run the Idris parser stack
57runparser :: Parser st res -> st -> String -> String -> Either ParseError res
58runparser :: Parser st res -> st -> String -> String -> Either ParseError res