Permalink
Browse files

Upgrade to Stackage LTS Haskell 10.7 (#240)

* Upgrade to Stackage LTS Haskell 10.7

* Fix broken build on Windows

> Error: While constructing the build plan, the following exceptions were encountered:
> In the dependencies for turtle-1.4.5:
>     Win32-2.5.4.1 from stack configuration does not match >=2.2.0.1 && <2.4 (latest matching version
>                   is 2.3.1.1)
> needed due to nirum-0.3.0 -> turtle-1.4.5
> Some potential ways to resolve this:
>   * Recommended action: try adding the following to your extra-deps
>     in C:\projects\nirum-k5n5y\stack.yaml:
> - Win32-2.3.1.1
>   * Set 'allow-newer: true' to ignore all version constraints and build anyway.
>   * You may also want to try using the 'stack solver' command.
> Plan construction failed.

[changelog skip]
  • Loading branch information...
dahlia committed Mar 3, 2018
1 parent fe176fb commit d80195a3f3ef7b2e170af594cd78ecffa7c8bd56
@@ -0,0 +1,66 @@
# HLint configuration file
# https://github.com/ndmitchell/hlint
##########################
# This file contains a template configuration file, which is typically
# placed as .hlint.yaml in the root of your project
# Specify additional command line arguments
#
# - arguments: [--color, --cpp-simple, -XQuasiQuotes]
# Control which extensions/flags/modules/functions can be used
#
# - extensions:
# - default: false # all extension are banned by default
# - name: [PatternGuards, ViewPatterns] # only these listed extensions can be used
# - {name: CPP, within: CrossPlatform} # CPP can only be used in a given module
#
# - flags:
# - {name: -w, within: []} # -w is allowed nowhere
#
# - modules:
# - {name: [Data.Set, Data.HashSet], as: Set} # if you import Data.Set qualified, it must be as 'Set'
# - {name: Control.Arrow, within: []} # Certain modules are banned entirely
#
# - functions:
# - {name: unsafePerformIO, within: []} # unsafePerformIO can only appear in no modules
# Add custom hints for this project
#
# Will suggest replacing "wibbleMany [myvar]" with "wibbleOne myvar"
# - error: {lhs: "wibbleMany [x]", rhs: wibbleOne x}
# Turn on hints that are off by default
#
# Ban "module X(module X) where", to require a real export list
# - warn: {name: Use explicit module export list}
#
# Replace a $ b $ c with a . b $ c
# - group: {name: dollar, enabled: true}
#
# Generalise map to fmap, ++ to <>
# - group: {name: generalise, enabled: true}
# Ignore some builtin hints
# - ignore: {name: Use let}
# - ignore: {name: Use const, within: SpecialModule} # Only within certain modules
- ignore:
name: Reduce duplication
within:
- Nirum.Parser
- Nirum.ParserSpec
- ignore: {name: Unnecessary hiding}
# Define some custom infix operators
# - fixity: infixr 3 ~^#^~
# To generate a suitable file for HLint do:
# $ hlint --default > .hlint.yaml
@@ -118,7 +118,8 @@ install:
fi
script:
- 'TOX="$(which tox)" stack --no-terminal test -j4 --coverage'
- ls -al "$(python3 -m site --user-base)/bin/tox"
- 'TOX="$(python3 -m site --user-base)/bin/tox" stack --no-terminal test -j4 --coverage'
- ./lint.sh
after_script:
@@ -22,10 +22,10 @@ install:
- ps: >
if((Test-Path $env:STACK_ROOT) -ne $true) {
if($env:PLATFORM -eq 'x86') {
$stackUrl = 'https://www.stackage.org/stack/windows-i386';
$stackUrl = 'https://github.com/commercialhaskell/stack/releases/download/v1.6.5/stack-1.6.5-windows-i386.zip';
}
elseif($env:PLATFORM -eq 'x64') {
$stackUrl = 'https://www.stackage.org/stack/windows-x86_64';
$stackUrl = 'https://github.com/commercialhaskell/stack/releases/download/v1.6.5/stack-1.6.5-windows-x86_64.zip';
}
Invoke-WebRequest -OutFile C:\stack.zip $stackUrl;
Add-Type -AssemblyName System.IO.Compression.FileSystem;
@@ -49,6 +49,7 @@ install:
- set
- C:\Python36\python -m pip install --upgrade tox pip setuptools
- stack --no-terminal install -j4 happy # haskell-src-exts requires happy
- stack --no-terminal install -j4 --only-dependencies
build_script:
- stack --no-terminal build -j4 --copy-bins --flag nirum:static
@@ -2,7 +2,7 @@ import Language.Haskell.HLint (hlint)
import System.Exit (exitFailure, exitSuccess)
arguments :: [String]
arguments = ["src", "test"]
arguments = ["app", "src", "test", "lint.hs"]
main :: IO ()
main = do
@@ -33,9 +33,16 @@ flags:
description: Static link
manual: true
default: false
ghc-options:
- -Wall
- -Werror
when:
- condition: os(darwin)
else:
ghc-options:
- -Werror
then:
ghc-options:
- -Werror
- -optP-Wno-nonportable-include-path
# The above option works around https://github.com/haskell/cabal/issues/4739
dependencies:
- base >=4.7 && <5
- blaze-html >=0.9.0.1 && <0.10
@@ -46,7 +53,7 @@ dependencies:
- filepath >=1.4 && <1.5
- htoml >=1.0.0.0 && <1.1.0.0
- interpolatedstring-perl6 >=1.0.0 && <1.1.0
- megaparsec >=5 && <5.4
- megaparsec >=6.3 && <6.4
- mtl >=2.2.1 && <3
- parsec # only for dealing with htoml's ParserError
- pretty >=1.1.3 && <2
@@ -56,6 +63,7 @@ dependencies:
library:
source-dirs: src
ghc-options:
- -Wall
- -fwarn-incomplete-uni-patterns
- -fprint-explicit-kinds
other-modules:
@@ -65,7 +73,7 @@ library:
- cmark >=0.5 && <0.6
- fsnotify >=0.2.1 && <0.3.0
- heterocephalus >=1.0.5 && <1.1.0
- optparse-applicative >=0.13.1 && <0.14
- optparse-applicative >=0.14 && <0.15
- shakespeare >=2.0.12 && <2.1
- stm >=2.4.4.1
- template-haskell >=2.11 && <3
@@ -75,6 +83,7 @@ executables:
main: nirum.hs
source-dirs: app
dependencies:
- base
- nirum
when:
- condition: flag(static)
@@ -83,6 +92,7 @@ executables:
- condition: os(darwin) || os(windows)
then:
ghc-options:
- -Wall
- -fwarn-incomplete-uni-patterns
- -threaded
- -with-rtsopts=-N
@@ -91,6 +101,7 @@ executables:
- -optc-Os
else:
ghc-options:
- -Wall
- -fwarn-incomplete-uni-patterns
- -threaded
- -with-rtsopts=-N
@@ -102,21 +113,24 @@ executables:
- -fPIC
else:
ghc-options:
- -Wall
- -fwarn-incomplete-uni-patterns
- -threaded
- -with-rtsopts=-N
tests:
hlint:
main: HLint.hs
source-dirs: test
main: lint.hs
dependencies:
- hlint >=2.0.9 && <2.1
spec:
main: Spec.hs
source-dirs: test
main: Main.hs
source-dirs:
- test
ghc-options:
- -Wall
- -fno-warn-incomplete-uni-patterns
- -fno-warn-missing-signatures
- -Wno-missing-signatures
- -threaded
- -with-rtsopts=-N
dependencies: # omit version specifiers for shared dependencies to library
@@ -18,11 +18,7 @@ import System.Exit (die)
import System.FilePath (takeDirectory, takeExtension, (</>))
import System.FSNotify
import Text.InterpolatedString.Perl6 (qq)
import Text.Megaparsec (Token)
import Text.Megaparsec.Error ( Dec
, ParseError (errorPos)
, parseErrorPretty
)
import Text.Megaparsec.Error (errorPos, parseErrorPretty)
import Text.Megaparsec.Pos (SourcePos (sourceLine, sourceColumn), unPos)
import Nirum.Constructs (Construct (toCode))
@@ -33,6 +29,7 @@ import Nirum.Package ( PackageError ( ImportError
, ParseError
, ScanError
)
, ParseError
, scanModules
)
import Nirum.Package.ModuleSet ( ImportError ( CircularImportError
@@ -67,9 +64,7 @@ data AppOptions = AppOptions { outputPath :: FilePath
debounceDelay :: Nanosecond
debounceDelay = 1 * 1000 * 1000
parseErrortoPrettyMessage :: ParseError (Token T.Text) Dec
-> FilePath
-> IO String
parseErrortoPrettyMessage :: ParseError -> FilePath -> IO String
parseErrortoPrettyMessage parseError' filePath' = do
sourceCode <- readFile filePath'
let sourceLines = lines sourceCode
@@ -22,12 +22,12 @@ module Nirum.Constructs.Identifier ( Identifier
import Data.Char (toLower, toUpper)
import Data.Maybe (fromMaybe)
import Data.String (IsString (fromString))
import Data.Void
import qualified Data.Text as T
import qualified Data.Set as S
import qualified Text.Megaparsec as P
import Text.Megaparsec.Char (oneOf, satisfy)
import Text.Megaparsec.Text (Parser)
import Nirum.Constructs (Construct (toCode))
@@ -64,7 +64,7 @@ reservedKeywords = [ "enum"
, "default"
]
identifierRule :: Parser Identifier
identifierRule :: P.Parsec Void T.Text Identifier
identifierRule = do
firstChar <- satisfy isAlpha
restChars <- P.many $ satisfy isAlnum
@@ -89,7 +89,7 @@ fromText text =
Right ident -> Just ident
Left _ -> Nothing
where
rule :: Parser Identifier
rule :: P.Parsec Void T.Text Identifier
rule = do
identifier' <- identifierRule
_ <- P.eof
@@ -1,6 +1,7 @@
module Nirum.Package
( Package (..)
, PackageError (..)
, ParseError
, docs
, resolveModule
, scanModules
@@ -1,4 +1,4 @@
{-# LANGUAGE GADTs, QuasiQuotes, RankNTypes, ScopedTypeVariables,
{-# LANGUAGE GADTs, LambdaCase, QuasiQuotes, RankNTypes, ScopedTypeVariables,
StandaloneDeriving, TypeFamilies #-}
module Nirum.Package.Metadata ( Author (Author, email, name, uri)
, Metadata ( Metadata
@@ -261,14 +261,14 @@ optional (Left (FieldError _)) = Right Nothing
optional (Left error') = Left error'
tableField :: MetadataField -> Table -> Either MetadataError Table
tableField = typedField "table" $ \ n -> case n of
VTable t -> Just t
_ -> Nothing
tableField = typedField "table" $ \ case
VTable t -> Just t
_ -> Nothing
stringField :: MetadataField -> Table -> Either MetadataError Text
stringField = typedField "string" $ \ n -> case n of
VString s -> Just s
_ -> Nothing
stringField = typedField "string" $ \ case
VString s -> Just s
_ -> Nothing
arrayField :: MetadataField -> Table -> Either MetadataError VArray
arrayField f t =
@@ -278,10 +278,9 @@ arrayField f t =
Left error' -> Left error'
where
arrayF :: MetadataField -> Table -> Either MetadataError VArray
arrayF = typedField "array" $ \ node ->
case node of
VArray array -> Just array
_ -> Nothing
arrayF = typedField "array" $ \ case
VArray array -> Just array
_ -> Nothing
tableArrayField :: MetadataField -> Table -> Either MetadataError VTArray
@@ -292,10 +291,9 @@ tableArrayField f t =
Left error' -> Left error'
where
arrayF :: MetadataField -> Table -> Either MetadataError VTArray
arrayF = typedField "array of tables" $ \ node ->
case node of
VTArray array -> Just array
_ -> Nothing
arrayF = typedField "array of tables" $ \ case
VTArray array -> Just array
_ -> Nothing
uriField :: MetadataField -> Table -> Either MetadataError URI
uriField field' table = do
@@ -33,11 +33,12 @@ module Nirum.Parser ( Parser
) where
import Control.Monad (void)
import Data.Void
import qualified System.IO as SIO
import qualified Data.List as L
import Data.Map.Strict as Map hiding (foldl)
import Data.Set hiding (empty, foldl, fromList, map)
import Data.Set hiding (foldl)
import qualified Data.Text as T
import qualified Data.Text.IO as TIO
import Text.Megaparsec hiding (ParseError, parse)
@@ -49,8 +50,7 @@ import Text.Megaparsec.Char ( char
, string'
)
import qualified Text.Megaparsec.Error as E
import Text.Megaparsec.Text (Parser)
import Text.Megaparsec.Lexer (charLiteral)
import Text.Megaparsec.Char.Lexer (charLiteral)
import qualified Nirum.Constructs.Annotation as A
import Nirum.Constructs.Declaration (Declaration)
@@ -80,7 +80,8 @@ import Nirum.Constructs.TypeExpression ( TypeExpression ( ListModifier
)
)
type ParseError = E.ParseError (Token T.Text) E.Dec
type Parser = Parsec Void T.Text
type ParseError = E.ParseError Char Void
-- CHECK: If a new reserved keyword is introduced, it has to be also
-- added to `reservedKeywords` set in the `Nirum.Constructs.Identifier`
@@ -494,7 +495,7 @@ typeDeclaration = do
let annotations = A.union annotationSet' $ typeAnnotations typeDecl
return $ typeDecl { typeAnnotations = annotations }
where
unless' :: [String] -> Parser a -> Parser a
unless' :: [T.Text] -> Parser a -> Parser a
unless' [] _ = fail "no candidates" -- Must never happen
unless' [s] p = notFollowedBy (string s) >> p
unless' (x : xs) p = notFollowedBy (string x) >> unless' xs p
@@ -662,5 +663,3 @@ parseFile path = do
SIO.hSetEncoding h SIO.utf8_bom
TIO.hGetContents h
return $ runParser file path code
{-# ANN module ("HLint: ignore Reduce duplication" :: String) #-}
@@ -1,14 +1,7 @@
{-# LANGUAGE QuasiQuotes, ScopedTypeVariables, TemplateHaskell #-}
module Nirum.Targets ( BuildError (CompileError, PackageError, TargetNameError)
, BuildResult
, Target ( CompileError
, CompileResult
, compilePackage
, parseTarget
, showCompileError
, targetName
, toByteString
)
, Target (..)
, TargetName
, buildPackage
, targetNames
Oops, something went wrong.

0 comments on commit d80195a

Please sign in to comment.