Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cabal-tree-diff/Cabal-tree-diff.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ library
, base
, Cabal-syntax ^>=3.19.0.0
, Cabal ^>=3.19.0.0
, tree-diff ^>=0.1 || ^>=0.2 || ^>=0.3
, tree-diff >=0.1 && < 0.5

exposed-modules: Data.TreeDiff.Instances.Cabal
other-modules:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ import Distribution.Client.Init.Types
import Distribution.Client.Compat.Prelude hiding (getLine, head, last, putStr, putStrLn)
import Prelude ()

import Data.List (last)
import qualified Data.List.NonEmpty as NEL

import Distribution.CabalSpecVersion (CabalSpecVersion (..))
Expand All @@ -56,15 +55,15 @@ import Distribution.Simple.Setup (fromFlagOrDefault, pattern Flag, pattern NoFla
import Distribution.Solver.Types.PackageIndex (elemByPackageName)
import Distribution.Types.Dependency (Dependency (..))
import Distribution.Types.PackageName (PackageName, unPackageName)
import Distribution.Utils.Generic (safeHead)
import Distribution.Utils.Generic (safeHead, safeLast)
import Distribution.Verbosity
import Distribution.Version (Version)

import Language.Haskell.Extension (Extension (..), Language (..))

import qualified Data.Set as Set
import Distribution.FieldGrammar.Newtypes
import System.FilePath (splitDirectories, (</>))
import System.FilePath ((</>))

-- | Main driver for interactive prompt code.
createProject
Expand Down Expand Up @@ -267,7 +266,7 @@ packageNameHeuristics sourcePkgDb flags = getPackageName flags $ do
defName <-
guessPackageName =<< case packageDir flags of
Flag a -> return a
NoFlag -> last . splitDirectories <$> getCurrentDirectory
NoFlag -> getCurrentDirectory

when (isPkgRegistered defName) $
putStrLn (inUseMsg defName)
Expand Down Expand Up @@ -413,7 +412,7 @@ libOtherModulesHeuristics flags = case otherModules flags of
if exists
then do
otherModules' <- filter isHaskell <$> listFilesRecursive libDir
filter ((`elem` otherCandidates) . last . components)
filter (maybe False (`elem` otherCandidates) . safeLast . components)
. catMaybes
<$> traverse retrieveModuleName otherModules'
else return []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,14 @@ import Distribution.Client.Compat.Prelude hiding (many, readFile, (<|>))
import Distribution.Simple.Setup (fromFlagOrDefault)

import Data.Functor ((<&>))
import qualified Data.List as L
import qualified Data.Set as Set
import Distribution.CabalSpecVersion
import Distribution.Client.Init.Defaults
import Distribution.Client.Init.FlagExtractors (getCabalVersionNoPrompt)
import Distribution.Client.Init.Types
import Distribution.Client.Init.Utils
import Distribution.FieldGrammar.Newtypes
import Distribution.Simple.Utils (ordNub)
import Distribution.Simple.Utils (ordNub, safeLast)
import Distribution.Types.PackageName (PackageName)
import Distribution.Version
import System.FilePath
Expand Down Expand Up @@ -101,7 +100,7 @@ guessPackageType flags = do
if fromFlagOrDefault False (initializeTestSuite flags)
then return TestSuite
else do
let lastDir dirs = L.last . splitDirectories $ dirs
let lastDir dirs = fromMaybe "" . safeLast . splitDirectories $ dirs
srcCandidates = [defaultSourceDir, "src", "source"]
testCandidates = [defaultTestDir, "test", "tests"]

Expand Down
52 changes: 51 additions & 1 deletion cabal-install/src/Distribution/Client/ProjectConfig/Types.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE NamedFieldPuns #-}

-- | Handling project configuration, types.
module Distribution.Client.ProjectConfig.Types
Expand Down Expand Up @@ -500,4 +501,53 @@ data BuildTimeSettings = BuildTimeSettings
}
deriving (Generic)

instance NFData BuildTimeSettings
-- | This instance avoids the deepseq deprecation of @NFData (a -> b)@ triggered
-- by buildSettingLogFile the alternative @instance NFData BuildTimeSettings@.
instance NFData BuildTimeSettings where
rnf
BuildTimeSettings
{ buildSettingDryRun
, buildSettingOnlyDeps
, buildSettingOnlyDownload
, buildSettingSummaryFile
, buildSettingLogFile
, buildSettingLogVerbosity
, buildSettingBuildReports
, buildSettingReportPlanningFailure
, buildSettingSymlinkBinDir
, buildSettingNumJobs
, buildSettingKeepGoing
, buildSettingOfflineMode
, buildSettingKeepTempFiles
, buildSettingRemoteRepos
, buildSettingLocalNoIndexRepos
, buildSettingCacheDir
, buildSettingHttpTransport
, buildSettingIgnoreExpiry
, buildSettingProgPathExtra
, buildSettingHaddockOpen
, buildSettingBuildTimings
} =
rnf
[ rnf buildSettingDryRun
, rnf buildSettingOnlyDeps
, rnf buildSettingOnlyDownload
, rnf buildSettingSummaryFile
, maybe () (`seq` ()) buildSettingLogFile
, rnf buildSettingLogVerbosity
, rnf buildSettingBuildReports
, rnf buildSettingReportPlanningFailure
, rnf buildSettingSymlinkBinDir
, rnf buildSettingNumJobs
, rnf buildSettingKeepGoing
, rnf buildSettingOfflineMode
, rnf buildSettingKeepTempFiles
, rnf buildSettingRemoteRepos
, rnf buildSettingLocalNoIndexRepos
, rnf buildSettingCacheDir
, rnf buildSettingHttpTransport
, rnf buildSettingIgnoreExpiry
, rnf buildSettingProgPathExtra
, rnf buildSettingHaddockOpen
, rnf buildSettingBuildTimings
]
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
packages: q/

if impl(ghc >= 10.0.1)
-- When ghc-10.0.1, or later, is released remove this conditional block and
-- the allow-newer exception.
packages: ghc-10.0.1-is-released-remove-this-workaround/
elif impl(ghc >= 10.0)
-- When using a pre-release of ghc-10
allow-newer: filepath:base
64 changes: 60 additions & 4 deletions project-cabal/ghc-latest.config
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,67 @@

-- NOTE: don't forget to update the compiler version in the conditional
-- when upgrading to a newer GHC
if impl(ghc >= 9.14.0)
if impl(ghc >= 10)
allow-newer:
--windns:*, rere:*, tree-diff:*, uuid-types:*, these:*, assoc:*, semialign:*, indexed-traversable-instances:*, indexed-traversable:*, OneTuple:*, scientific:*, time-compat:*, text-short:*, integer-conversion:*, generically:*, data-fix:*, binary:*
-- Artem, 2024-04-21: I started and then gave up...
*:base, *:template-haskell, text-short, *:deepseq, *:bytestring, *:ghc-prim, *:ghc-bignum, *:containers
aeson:template-haskell
, aeson:time
, assoc:base
, async:base
, bifunctors:template-haskell
, Cabal-3.12.1.0:containers
, Cabal-3.12.1.0:time
, Cabal-syntax-3.12.1.0:containers
, Cabal-syntax-3.12.1.0:time
, cabal-testsuite:containers
, data-fix:base
, hackage-security:base
, hackage-security:ghc-prim
, hackage-security:template-haskell
, hackage-security:time
, hsc2hs:base
, HTTP:base
, HTTP:time
, indexed-traversable:base
, indexed-traversable-instances:base
, integer-conversion:base
, integer-logarithms:base
, nothunks:containers
, nothunks:time
, OneTuple:base
, parallel:base
, primitive:base
, scientific:base
, scientific:template-haskell
, semialign:base
, splitmix:base
, tagged:template-haskell
, tasty-bench:ghc-prim
, text-iso8601:time
, text-short:base
, text-short:ghc-prim
, text-short:template-haskell
, th-abstraction:template-haskell
, th-compat:template-haskell
, these:base
, time-compat:base
, time-compat:time
, tree-diff:base
, unordered-containers:template-haskell
, uuid-types:template-haskell
, vector:base
, vector-stream:base
, vector-stream:ghc-prim
, vector-th-unbox:template-haskell
, zinza:base
, zlib:base
source-repository-package
type: git
location: https://github.com/typechecker/hashable.git
tag: fb9badd5ae735c7be180242bdde7ea0f5a230cfd
source-repository-package
type: git
location: https://github.com/typechecker/vector-th-unbox.git
tag: 39832ca661766155d4dae6faa1275cdcabe516b8

-- repository head.hackage.ghc.haskell.org
-- url: https://ghc.gitlab.haskell.org/head.hackage/
Expand Down
Loading