Skip to content

Commit

Permalink
Build with GHC8 and trifecta-1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
KaneTW committed Jul 3, 2016
1 parent e84774a commit a09a1bf
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 23 deletions.
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ addons:
- ghc-7.6.3
- ghc-7.8.4
- ghc-7.10.2
- ghc-8.0.1
- cabal-install-1.20
- cabal-install-1.22
- cabal-install-1.24
# test dependencies
- expect
- cppcheck
Expand All @@ -35,6 +37,12 @@ matrix:
compiler: ": #GHC 7.10.2"
- env: CABALVER="1.22" GHCVER="7.10.2" TESTS="test_c"
compiler: ": #GHC 7.10.2"
- env: CABALVER="1.24" GHCVER="8.0.1" TESTS="lib_doc doc"
compiler: ": #GHC 8.0.1"
- env: CABALVER="1.24" GHCVER="8.0.1" TESTS="test_js"
compiler: ": #GHC 8.0.1"
- env: CABALVER="1.24" GHCVER="8.0.1" TESTS="test_c"
compiler: ": #GHC 8.0.1"

cache:
directories:
Expand Down
10 changes: 5 additions & 5 deletions idris.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -1027,7 +1027,7 @@ Library
, ansi-terminal < 0.7
, ansi-wl-pprint < 0.7
, base64-bytestring < 1.1
, binary >= 0.7 && < 0.8
, binary >= 0.7 && < 0.9
, blaze-html >= 0.6.1.3 && < 0.9
, blaze-markup >= 0.5.2.1 && < 0.8
, bytestring < 0.11
Expand All @@ -1044,14 +1044,14 @@ Library
, optparse-applicative >= 0.11 && < 0.13
, parsers >= 0.9 && < 0.13
, pretty < 1.2
, process < 1.3
, process < 1.5
, split < 0.3
, terminal-size < 0.4
, text >=1.2.1.0 && < 1.3
, time >= 1.4 && < 1.6
, transformers < 0.5
, time >= 1.4 && < 1.7
, transformers < 0.6
, transformers-compat >= 0.3
, trifecta >= 1.1 && < 1.6
, trifecta >= 1.6 && < 1.7
, uniplate >=1.6 && < 1.7
, unordered-containers < 0.3
, utf8-string < 1.1
Expand Down
4 changes: 2 additions & 2 deletions src/Idris/Parser.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1569,7 +1569,7 @@ parseImports :: FilePath -> String -> Idris (Maybe (Docstring ()), [String], [Im
parseImports fname input
= do i <- getIState
case parseString (runInnerParser (evalStateT imports i)) (Directed (UTF8.fromString fname) 0 0 0 0) input of
Failure err -> fail (show err)
Failure (ErrInfo err _) -> fail (show err)
Success (x, annots, i) ->
do putIState i
fname' <- runIO $ Dir.makeAbsolute fname
Expand Down Expand Up @@ -1631,7 +1631,7 @@ parseProg :: SyntaxInfo -> FilePath -> String -> Maybe Delta ->
parseProg syn fname input mrk
= do i <- getIState
case runparser mainProg i fname input of
Failure doc -> do -- FIXME: Get error location from trifecta
Failure (ErrInfo doc _) -> do -- FIXME: Get error location from trifecta
-- this can't be the solution!
-- Issue #1575 on the issue tracker.
-- https://github.com/idris-lang/Idris-dev/issues/1575
Expand Down
15 changes: 15 additions & 0 deletions src/Idris/Parser/Helpers.hs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,21 @@ newtype IdrisInnerParser a = IdrisInnerParser { runInnerParser :: Parser a }

deriving instance Parsing IdrisInnerParser

#if MIN_VERSION_base(4,9,0)
instance {-# OVERLAPPING #-} DeltaParsing IdrisParser where
line = lift line
{-# INLINE line #-}
position = lift position
{-# INLINE position #-}
slicedWith f (StateT m) = StateT $ \s -> slicedWith (\(a,s') b -> (f a b, s')) $ m s
{-# INLINE slicedWith #-}
rend = lift rend
{-# INLINE rend #-}
restOfLine = lift restOfLine
{-# INLINE restOfLine #-}

#endif

#if MIN_VERSION_base(4,8,0)
instance {-# OVERLAPPING #-} TokenParsing IdrisParser where
#else
Expand Down
6 changes: 3 additions & 3 deletions src/Idris/Prover.hs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import qualified Idris.IdeMode as IdeMode
import Idris.Output
import Idris.TypeSearch (searchByType)

import Text.Trifecta.Result(Result(..))
import Text.Trifecta.Result(Result(..), ErrInfo(..))

import System.IO (Handle, stdin, stdout, hPutStrLn)
import System.Console.Haskeline
Expand Down Expand Up @@ -325,7 +325,7 @@ elabloop info fn d prompt prf e prev h env
(d, prev', st, done, prf', env', res) <-
idrisCatch
(case cmd of
Failure err ->
Failure (ErrInfo err _) ->
return (False, prev, e, False, prf, env, Left . Msg . show . fixColour (idris_colourRepl ist) $ err)
Success (Left cmd') ->
case cmd' of
Expand Down Expand Up @@ -440,7 +440,7 @@ ploop fn d prompt prf e h
_ -> return ()
(d, st, done, prf', res) <- idrisCatch
(case cmd of
Failure err -> return (False, e, False, prf, Left . Msg . show . fixColour (idris_colourRepl i) $ err)
Failure (ErrInfo err _) -> return (False, e, False, prf, Left . Msg . show . fixColour (idris_colourRepl i) $ err)
Success Undo -> do (_, st) <- elabStep e loadState
return (True, st, False, init prf, Right $ iPrintResult "")
Success ProofState -> return (True, e, False, prf, Right $ iPrintResult "")
Expand Down
20 changes: 10 additions & 10 deletions src/Idris/REPL.hs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ import Data.List.Split (splitOn)
import Data.List (groupBy)
import qualified Data.Text as T

import Text.Trifecta.Result(Result(..))
import Text.Trifecta.Result(Result(..), ErrInfo(..))

import System.Console.Haskeline as H
import System.FilePath
Expand Down Expand Up @@ -190,7 +190,7 @@ processNetCmd :: IState -> IState -> Handle -> FilePath -> String ->
IO (IState, FilePath)
processNetCmd orig i h fn cmd
= do res <- case parseCmd i "(net)" cmd of
Failure err -> return (Left (Msg " invalid command"))
Failure (ErrInfo err _) -> return (Left (Msg " invalid command"))
Success (Right c) -> runExceptT $ evalStateT (processNet fn c) i
Success (Left err) -> return (Left (Msg err))
case res of
Expand Down Expand Up @@ -307,7 +307,7 @@ runIdeModeCommand h id orig fn mods (IdeMode.Interpret cmd) =
do c <- colourise
i <- getIState
case parseCmd i "(input)" cmd of
Failure err -> iPrintError $ show (fixColour False err)
Failure (ErrInfo err _) -> iPrintError $ show (fixColour False err)
Success (Right (Prove mode n')) ->
idrisCatch
(do process fn (Prove mode n')
Expand Down Expand Up @@ -722,8 +722,8 @@ processInput cmd orig inputs efile
let fn = fromMaybe "" (listToMaybe inputs)
c <- colourise
case parseCmd i "(input)" cmd of
Failure err -> do iputStrLn $ show (fixColour c err)
return (Just inputs)
Failure (ErrInfo err _) -> do iputStrLn $ show (fixColour c err)
return (Just inputs)
Success (Right Reload) ->
reload orig inputs
Success (Right Watch) ->
Expand Down Expand Up @@ -1787,8 +1787,8 @@ idrisMain opts =
mapM_ (\str -> do ist <- getIState
c <- colourise
case parseExpr ist str of
Failure err -> do iputStrLn $ show (fixColour c err)
runIO $ exitWith (ExitFailure 1)
Failure (ErrInfo err _) -> do iputStrLn $ show (fixColour c err)
runIO $ exitWith (ExitFailure 1)
Success e -> process "" (Eval e))
exprs
runIO exitSuccess
Expand Down Expand Up @@ -1843,8 +1843,8 @@ execScript :: String -> Idris ()
execScript expr = do i <- getIState
c <- colourise
case parseExpr i expr of
Failure err -> do iputStrLn $ show (fixColour c err)
runIO $ exitWith (ExitFailure 1)
Failure (ErrInfo err _) -> do iputStrLn $ show (fixColour c err)
runIO $ exitWith (ExitFailure 1)
Success term -> do ctxt <- getContext
(tm, _) <- elabVal (recinfo (fileFC "toplevel")) ERHS term
res <- execute tm
Expand Down Expand Up @@ -1879,7 +1879,7 @@ initScript = do script <- getInitScript
runInit h
processLine i cmd input clr =
case parseCmd i input cmd of
Failure err -> runIO $ print (fixColour clr err)
Failure (ErrInfo err _) -> runIO $ print (fixColour clr err)
Success (Right Reload) -> iPrintError "Init scripts cannot reload the file"
Success (Right (Load f _)) -> iPrintError "Init scripts cannot load files"
Success (Right (ModImport f)) -> iPrintError "Init scripts cannot import modules"
Expand Down
16 changes: 15 additions & 1 deletion src/Pkg/PParser.hs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,20 @@ defaultPkg = PkgDesc "" Nothing Nothing Nothing Nothing
instance HasLastTokenSpan PParser where
getLastTokenSpan = return Nothing

#if MIN_VERSION_base(4,9,0)
instance {-# OVERLAPPING #-} DeltaParsing PParser where
line = lift line
{-# INLINE line #-}
position = lift position
{-# INLINE position #-}
slicedWith f (StateT m) = StateT $ \s -> slicedWith (\(a,s') b -> (f a b, s')) $ m s
{-# INLINE slicedWith #-}
rend = lift rend
{-# INLINE rend #-}
restOfLine = lift restOfLine
{-# INLINE restOfLine #-}
#endif

#if MIN_VERSION_base(4,8,0)
instance {-# OVERLAPPING #-} TokenParsing PParser where
#else
Expand All @@ -71,7 +85,7 @@ parseDesc :: FilePath -> IO PkgDesc
parseDesc fp = do
p <- readFile fp
case runparser pPkg defaultPkg fp p of
Failure err -> fail (show $ PP.plain err)
Failure (ErrInfo err _) -> fail (show $ PP.plain err)
Success x -> return x

pPkg :: PParser PkgDesc
Expand Down
5 changes: 3 additions & 2 deletions stack.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
resolver: lts-6.4
resolver: lts-6.5

packages:
- '.'
- location: .

flags:
idris:
Expand All @@ -10,6 +10,7 @@ flags:

extra-deps:
- libffi-0.1
- trifecta-1.6

nix:
enable: false
Expand Down

0 comments on commit a09a1bf

Please sign in to comment.