Skip to content

Commit

Permalink
Compile with GHC 8.8
Browse files Browse the repository at this point in the history
This doesn't include the updates needed for Cabal 3.0 compatibility.
  • Loading branch information
melted committed Jan 22, 2020
1 parent 4d8d85d commit 86892c5
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
9 changes: 5 additions & 4 deletions idris.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ source-repository head

custom-setup
setup-depends:
Cabal >= 1.10 && <2.5,
Cabal >= 1.10 && < 3.1,
base >= 4 && <5,
directory,
filepath,
Expand Down Expand Up @@ -292,16 +292,16 @@ Library
, megaparsec >= 7.0.4 && < 8
, mtl >= 2.1 && < 2.3
, network >= 2.7 && < 2.9
, optparse-applicative >= 0.13 && < 0.15
, optparse-applicative >= 0.13 && < 0.16
, parser-combinators >= 1.0.0
, pretty < 1.2
, process < 1.7
, regex-tdfa >= 1.2
, safe >= 0.3.9
, split < 0.3
, terminal-size < 0.4
, text >=1.2.1.0 && < 1.3
, time >= 1.4 && < 1.9
, text >=1.2.1.0 && < 1.4
, time >= 1.4 && < 2.0
, transformers >= 0.5 && < 0.6
, uniplate >=1.6 && < 1.7
, unordered-containers < 0.3
Expand All @@ -314,6 +314,7 @@ Library

if !impl(ghc >= 8.0)
Build-Depends: semigroups == 0.18.*
, fail == 4.9.0.*

Default-Language: Haskell2010
ghc-prof-options: -auto-all -caf-all
Expand Down
5 changes: 3 additions & 2 deletions src/Idris/CmdOptions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import Idris.Info (getIdrisVersion)
import Idris.Options
import IRTS.CodegenCommon

import qualified Control.Monad.Fail as Fail
import Control.Monad.Trans (lift)
import Control.Monad.Trans.Except (throwE)
import Control.Monad.Trans.Reader (ask)
Expand Down Expand Up @@ -264,7 +265,7 @@ parseCodegen :: String -> Codegen
parseCodegen "bytecode" = Bytecode
parseCodegen cg = Via IBCFormat (map toLower cg)

parseLogCats :: Monad m => String -> m [LogCat]
parseLogCats :: Fail.MonadFail m => String -> m [LogCat]
parseLogCats s =
case lastMay (readP_to_S doParse s) of
Just (xs, _) -> return xs
Expand All @@ -290,7 +291,7 @@ parseLogCats s =
s <- look
fail $ "Category: " ++ s ++ " is not recognised."

parseConsoleWidth :: Monad m => String -> m ConsoleWidth
parseConsoleWidth :: Fail.MonadFail m => String -> m ConsoleWidth
parseConsoleWidth "auto" = return AutomaticWidth
parseConsoleWidth "infinite" = return InfinitelyWide
parseConsoleWidth s =
Expand Down
2 changes: 1 addition & 1 deletion src/Idris/Core/CaseTree.hs
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ groupCons cs = gc [] cs
PConst cval -> return $ addConG cval (ps, res) acc
PSuc n -> return $ addg False CSuc [n] (ps, res) acc
PReflected fn args -> return $ addg False (CFn fn) args (ps, res) acc
pat -> fail $ show pat ++ " is not a constructor or constant (can't happen)"
pat -> error $ show pat ++ " is not a constructor or constant (can't happen)"

addg uniq c conargs res []
= [ConGroup uniq c [(conargs, res)]]
Expand Down
6 changes: 6 additions & 0 deletions src/Idris/Core/TT.hs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ import qualified Prelude as S (Semigroup(..))
import Control.Applicative (Alternative, Applicative(..))
import qualified Control.Applicative as A (Alternative(..))
import Control.DeepSeq (($!!))
import qualified Control.Monad.Fail as Fail
import Control.Monad.State.Strict
import Data.Binary hiding (get, put)
import Data.Char
Expand Down Expand Up @@ -324,6 +325,11 @@ bindTC x k = case x of
instance Monad TC where
return x = OK x
x >>= k = bindTC x k
#if !(MIN_VERSION_base(4,12,0))
fail = Fail.fail
#endif

instance Fail.MonadFail TC where
fail e = Error (InternalMsg e)

instance MonadPlus TC where
Expand Down
3 changes: 2 additions & 1 deletion src/Idris/Parser/Stack.hs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import Idris.Core.TT (FC(..))
import Idris.Output (Message(..))

import Control.Arrow (app)
import qualified Control.Monad.Fail as Fail
import Control.Monad.State.Strict (StateT(..), evalStateT)
import Control.Monad.Writer.Strict (MonadWriter(..), WriterT(..), listen,
runWriterT, tell)
Expand All @@ -51,7 +52,7 @@ import qualified Util.Pretty as PP
type Parser s = StateT s (WriterT FC (P.Parsec Void String))

-- | A constraint for parsing without state
type Parsing m = (P.MonadParsec Void String m, MonadWriter FC m)
type Parsing m = (Fail.MonadFail m, P.MonadParsec Void String m, MonadWriter FC m)

-- | Run the Idris parser stack
runparser :: Parser st res -> st -> String -> String -> Either ParseError res
Expand Down

0 comments on commit 86892c5

Please sign in to comment.