Skip to content
This repository has been archived by the owner on Sep 28, 2019. It is now read-only.

Commit

Permalink
Upgrade to Stackage nightly 2017-11-17
Browse files Browse the repository at this point in the history
  • Loading branch information
tfausak committed Nov 17, 2017
1 parent 1b3bd73 commit 861f0f9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 11 deletions.
32 changes: 23 additions & 9 deletions library/Grawlix/Sync.hs
Expand Up @@ -32,6 +32,8 @@ import qualified Distribution.ModuleName as Cabal
import qualified Distribution.Package as Cabal
import qualified Distribution.PackageDescription as Cabal
import qualified Distribution.PackageDescription.Parse as Cabal
import qualified Distribution.Types.CondTree as Cabal
import qualified Distribution.Types.UnqualComponentName as Cabal
import qualified Distribution.Text as Cabal
import qualified Distribution.Version as Cabal
import qualified Hasql.Connection as Sql
Expand Down Expand Up @@ -276,7 +278,7 @@ toPackage package = Package
|> Cabal.packageDescription
|> Cabal.package
|> Cabal.pkgVersion
|> Cabal.versionBranch
|> Cabal.versionNumbers
|> map intToInt32
|> Tagged.Tagged
, packageRevision = package
Expand Down Expand Up @@ -463,7 +465,7 @@ renderCondition condition = case condition of
renderConfVar :: Cabal.ConfVar -> String
renderConfVar confVar = case confVar of
Cabal.Arch arch -> concat ["arch(", Cabal.display arch, ")"]
Cabal.Flag (Cabal.FlagName flag) -> concat ["flag(", flag, ")"]
Cabal.Flag flag -> concat ["flag(", Cabal.unFlagName flag, ")"]
Cabal.Impl compiler constraint -> concat
[ "impl("
, Cabal.display compiler
Expand Down Expand Up @@ -500,7 +502,11 @@ toExecutable
:: (Cabal.Executable, ([Cabal.Condition Cabal.ConfVar], [Cabal.Dependency]))
-> Executable
toExecutable (executable, (conditions, constraints)) = Executable
{ executableName = executable |> Cabal.exeName |> Text.pack |> Tagged.Tagged
{ executableName = executable
|> Cabal.exeName
|> Cabal.unUnqualComponentName
|> Text.pack
|> Tagged.Tagged
, executableCondition = toCondition conditions
, executableDependencies = executable
|> Cabal.buildInfo
Expand All @@ -515,7 +521,11 @@ toTest
:: (Cabal.TestSuite, ([Cabal.Condition Cabal.ConfVar], [Cabal.Dependency]))
-> Test
toTest (test, (conditions, constraints)) = Test
{ testName = test |> Cabal.testName |> Text.pack |> Tagged.Tagged
{ testName = test
|> Cabal.testName
|> Cabal.unUnqualComponentName
|> Text.pack
|> Tagged.Tagged
, testCondition = toCondition conditions
, testDependencies = test
|> Cabal.testBuildInfo
Expand All @@ -532,6 +542,7 @@ toBenchmark
toBenchmark (benchmark, (conditions, constraints)) = Benchmark
{ benchmarkName = benchmark
|> Cabal.benchmarkName
|> Cabal.unUnqualComponentName
|> Text.pack
|> Tagged.Tagged
, benchmarkCondition = toCondition conditions
Expand All @@ -558,14 +569,17 @@ nodeToTree condition node = Tree.Node
(condition, Cabal.condTreeConstraints node, Cabal.condTreeData node)
, Tree.subForest = node
|> Cabal.condTreeComponents
|> concatMap componentToForest
|> concatMap branchToForest
}


componentToForest
:: (Cabal.Condition v, Cabal.CondTree v c a, Maybe (Cabal.CondTree v c a))
branchToForest
:: Cabal.CondBranch v c a
-> Tree.Forest (Cabal.Condition v, c, a)
componentToForest (condition, ifTrue, maybeIfFalse) = let
branchToForest branch = let
condition = Cabal.condBranchCondition branch
ifTrue = Cabal.condBranchIfTrue branch
maybeIfFalse = Cabal.condBranchIfFalse branch
first = nodeToTree condition ifTrue
rest = case maybeIfFalse of
Nothing -> []
Expand Down Expand Up @@ -600,7 +614,7 @@ fromEntries = Tar.foldEntries (:) [] (\ _ -> [])
parseDescription :: LazyText.Text -> Maybe Cabal.GenericPackageDescription
parseDescription contents = contents
|> LazyText.unpack
|> Cabal.parsePackageDescription
|> Cabal.parseGenericPackageDescription
|> fromParseResult


Expand Down
2 changes: 1 addition & 1 deletion library/Grawlix/Types.hs
Expand Up @@ -126,7 +126,7 @@ instance HttpApiData.FromHttpApiData Version where
|> (\ results -> case results of
[] -> "invalid version" |> Text.pack |> Left
version : _ -> version
|> Cabal.versionBranch
|> Cabal.versionNumbers
|> map intToInt32
|> Tagged.Tagged
|> Right)
Expand Down
2 changes: 1 addition & 1 deletion stack.yaml
@@ -1 +1 @@
resolver: lts-9.0
resolver: nightly-2017-11-17

1 comment on commit 861f0f9

@tfausak
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this upgraded Cabal to version 2, it caught some packages that previously failed to parse. These are the packages on Hackage that require Cabal 2:

haddock-library                              1.4.4                  0   new
haddock-api                                  2.18.1                 0   new
ghc                                          8.2.1                  0   new
haddock-api                                  2.18.1                 1   new
haddock-library                              1.4.5                  0   new
cabal-plan                                   0.2.0.0                0   new
text-containers                              0.1.0.0                0   new

Lots of ^>= bounds.

Please sign in to comment.