Skip to content

Commit 07bd438

Browse files
committed
Remove various prefixes from field names of types
ed/ExtraDirs, gdi/GHCDownloadInfo, un/GhcOptions, ili/InstalledLibraryInfo, un/ExeName, bio/BuildInfoOpts, un/MemoizedWith, fci/FileCacheHash, si/SetupInfo, rtp/RepoTemplatePath, get/IntersectingVersionRange. Also remove redundant `$` in `pure $ Constructor { ... }`.
1 parent 023fb60 commit 07bd438

28 files changed

+136
-130
lines changed

src/GHC/Utils/GhcPkg/Main/Compat.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,8 @@ readParseDatabase mode path = do
398398
[InstalledPackageInfo]
399399
-> GhcPkg.DbOpenMode mode GhcPkg.PackageDbLock
400400
-> RIO env (PackageDB mode)
401-
mkPackageDB pkgs lock = do
402-
pure $ PackageDB
401+
mkPackageDB pkgs lock =
402+
pure PackageDB
403403
{ location = path
404404
, packageDbLock = lock
405405
, packages = pkgs

src/Stack/Build/Cache.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ flagCacheKey installed = do
266266
installationRoot <- installationRootLocal
267267
case installed of
268268
Library _ installedInfo -> do
269-
let gid = installedInfo.iliId
269+
let gid = installedInfo.ghcPkgId
270270
pure $ configCacheKey installationRoot (ConfigCacheTypeFlagLibrary gid)
271271
Executable ident -> pure $
272272
configCacheKey installationRoot (ConfigCacheTypeFlagExecutable ident)

src/Stack/Build/ExecutePackage.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -999,7 +999,7 @@ singleTest topts testsToRun ac ee task installedMap = do
999999
idMap <- liftIO $ readTVarIO ee.ghcPkgIds
10001000
pure $ Map.lookup (taskProvides task) idMap
10011001
let pkgGhcIdList = case installed of
1002-
Just (Library _ libInfo) -> [libInfo.iliId]
1002+
Just (Library _ libInfo) -> [libInfo.ghcPkgId]
10031003
_ -> []
10041004
-- doctest relies on template-haskell in QuickCheck-based tests
10051005
thGhcId <-

src/Stack/Build/Installed.hs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
{-# LANGUAGE NoImplicitPrelude #-}
2-
{-# LANGUAGE OverloadedRecordDot #-}
3-
{-# LANGUAGE OverloadedStrings #-}
4-
{-# LANGUAGE ScopedTypeVariables #-}
1+
{-# LANGUAGE NoImplicitPrelude #-}
2+
{-# LANGUAGE DuplicateRecordFields #-}
3+
{-# LANGUAGE OverloadedRecordDot #-}
4+
{-# LANGUAGE OverloadedStrings #-}
5+
{-# LANGUAGE ScopedTypeVariables #-}
56

67
-- Determine which packages are already installed
78
module Stack.Build.Installed
@@ -298,12 +299,12 @@ gatherAndTransformSubLoadHelper lh =
298299
(_, Library _ existingLibInfo)
299300
= ( pLoc
300301
, Library pn existingLibInfo
301-
{ iliSublib = Map.union
302-
incomingLibInfo.iliSublib
303-
existingLibInfo.iliSublib
304-
, iliId = if isJust lh.lhSublibrary
305-
then existingLibInfo.iliId
306-
else incomingLibInfo.iliId
302+
{ subLib = Map.union
303+
incomingLibInfo.subLib
304+
existingLibInfo.subLib
305+
, ghcPkgId = if isJust lh.lhSublibrary
306+
then existingLibInfo.ghcPkgId
307+
else incomingLibInfo.ghcPkgId
307308
}
308309
)
309310
onPreviousLoadHelper newVal _oldVal = newVal
@@ -316,5 +317,5 @@ gatherAndTransformSubLoadHelper lh =
316317
(Library (PackageIdentifier _sublibMungedPackageName version) libInfo)
317318
= Library
318319
(PackageIdentifier key version)
319-
libInfo {iliSublib = Map.singleton sd.libraryName libInfo.iliId}
320+
libInfo { subLib = Map.singleton sd.libraryName libInfo.ghcPkgId }
320321
updateAsSublib _ v = v

src/Stack/Build/Source.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ checkBuildCache oldCache files = do
462462
go fp _ _ | takeFileName fp == "cabal_macros.h" = pure (Set.empty, Map.empty)
463463
-- Common case where it's in the cache and on the filesystem.
464464
go fp (Just digest') (Just fci)
465-
| fci.fciHash == digest' = pure (Set.empty, Map.singleton fp fci)
465+
| fci.hash == digest' = pure (Set.empty, Map.singleton fp fci)
466466
| otherwise =
467467
pure (Set.singleton fp, Map.singleton fp $ FileCacheInfo digest')
468468
-- Missing file. Add it to dirty files, but no FileCacheInfo.

src/Stack/Config.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ configFromConfigMonoid
326326
os = defOS
327327
platform = Platform arch os
328328
requireStackVersion = simplifyVersionRange
329-
configMonoid.requireStackVersion.getIntersectingVersionRange
329+
configMonoid.requireStackVersion.intersectingVersionRange
330330
compilerCheck = fromFirst MatchMinor configMonoid.compilerCheck
331331
platformVariant <- liftIO $
332332
maybe PlatformVariantNone PlatformVariant <$> lookupEnv platformVariantEnvVar

src/Stack/Config/Docker.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import Stack.Types.Docker
2020
, DockerOptsMonoid (..), dockerImageArgName
2121
)
2222
import Stack.Types.Resolver ( AbstractResolver (..) )
23-
import Stack.Types.Version ( getIntersectingVersionRange )
23+
import Stack.Types.Version ( IntersectingVersionRange (..) )
2424

2525
-- | Type representing exceptions thrown by functions exported by the
2626
-- "Stack.Config.Docker" module.
@@ -105,9 +105,9 @@ dockerOptsFromMonoid mproject maresolver dockerMonoid = do
105105
setUser = getFirst dockerMonoid.setUser
106106
requireDockerVersion =
107107
simplifyVersionRange
108-
dockerMonoid.requireDockerVersion.getIntersectingVersionRange
108+
dockerMonoid.requireDockerVersion.intersectingVersionRange
109109
stackExe = getFirst dockerMonoid.stackExe
110-
pure $ DockerOpts
110+
pure DockerOpts
111111
{ enable
112112
, image
113113
, registryLogin

src/Stack/Config/Nix.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ nixOptsFromMonoid nixMonoid os = do
7373

7474
when (not (null packages) && isJust initFile) $
7575
throwIO NixCannotUseShellFileAndPackagesException
76-
pure $ NixOpts
76+
pure NixOpts
7777
{ enable
7878
, pureShell
7979
, packages

src/Stack/Ghci.hs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -536,12 +536,12 @@ runGhci
536536
++ M.foldMapWithKey subDepsPackageUnhide exposeInternalDep
537537
else []
538538
oneWordOpts bio
539-
| shouldHidePackages = bio.bioOneWordOpts ++ bio.bioPackageFlags
540-
| otherwise = bio.bioOneWordOpts
539+
| shouldHidePackages = bio.oneWordOpts ++ bio.packageFlags
540+
| otherwise = bio.oneWordOpts
541541
genOpts = nubOrd
542542
(concatMap (concatMap (oneWordOpts . snd) . (.ghciPkgOpts)) pkgs)
543543
(omittedOpts, ghcOpts) = L.partition badForGhci $
544-
concatMap (concatMap ((.bioOpts) . snd) . (.ghciPkgOpts)) pkgs
544+
concatMap (concatMap ((.opts) . snd) . (.ghciPkgOpts)) pkgs
545545
++ map
546546
T.unpack
547547
( fold config.ghcOptionsByCat
@@ -623,7 +623,7 @@ writeMacrosFile ::
623623
writeMacrosFile outputDirectory pkgs = do
624624
fps <- fmap (nubOrd . catMaybes . concat) $
625625
forM pkgs $ \pkg -> forM pkg.ghciPkgOpts $ \(_, bio) -> do
626-
let cabalMacros = bio.bioCabalMacros
626+
let cabalMacros = bio.cabalMacros
627627
exists <- liftIO $ doesFileExist cabalMacros
628628
if exists
629629
then pure $ Just cabalMacros
@@ -1076,7 +1076,7 @@ checkForIssues pkgs =
10761076
where
10771077
(xs, ys) = L.partition (any f . snd) compsWithOpts
10781078
compsWithOpts = map (\(k, bio) ->
1079-
(k, bio.bioOneWordOpts ++ bio.bioOpts)) compsWithBios
1079+
(k, bio.oneWordOpts ++ bio.opts)) compsWithBios
10801080
compsWithBios =
10811081
[ ((pkg.ghciPkgName, c), bio)
10821082
| pkg <- pkgs

src/Stack/New.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ settingsFromRepoTemplatePath (RepoTemplatePath GitHub user name) = do
445445
basicAuthMsg altGitHubTokenEnvVar
446446
pure $ Just (gitHubBasicAuthType, fromString wantAltGitHubToken)
447447
else pure Nothing
448-
pure $ TemplateDownloadSettings
448+
pure TemplateDownloadSettings
449449
{ tplDownloadUrl = concat
450450
[ "https://api.github.com/repos/"
451451
, T.unpack user

0 commit comments

Comments
 (0)