Skip to content

Commit c998b53

Browse files
committed
Add more type signatures
1 parent 5dea84a commit c998b53

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

src/Stack/ComponentFile.hs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,19 @@ stackBenchmarkFiles ::
8181
stackBenchmarkFiles bench =
8282
resolveComponentFiles (CBench bench.name) build names
8383
where
84+
names :: [DotCabalDescriptor]
8485
names = bnames <> exposed
86+
87+
exposed :: [DotCabalDescriptor]
8588
exposed =
8689
case bench.interface of
8790
BenchmarkExeV10 _ fp -> [DotCabalMain fp]
8891
BenchmarkUnsupported _ -> []
92+
93+
bnames :: [DotCabalDescriptor]
8994
bnames = map DotCabalModule build.otherModules
95+
96+
build :: StackBuildInfo
9097
build = bench.buildInfo
9198

9299
-- | Get all files referenced by the test.
@@ -96,13 +103,20 @@ stackTestSuiteFiles ::
96103
stackTestSuiteFiles test =
97104
resolveComponentFiles (CTest test.name) build names
98105
where
106+
names :: [DotCabalDescriptor]
99107
names = bnames <> exposed
108+
109+
exposed :: [DotCabalDescriptor]
100110
exposed =
101111
case test.interface of
102112
TestSuiteExeV10 _ fp -> [DotCabalMain fp]
103113
TestSuiteLibV09 _ mn -> [DotCabalModule mn]
104114
TestSuiteUnsupported _ -> []
115+
116+
bnames :: [DotCabalDescriptor]
105117
bnames = map DotCabalModule build.otherModules
118+
119+
build :: StackBuildInfo
106120
build = test.buildInfo
107121

108122
-- | Get all files referenced by the executable.
@@ -112,7 +126,10 @@ stackExecutableFiles ::
112126
stackExecutableFiles exe =
113127
resolveComponentFiles (CExe exe.name) build names
114128
where
129+
build :: StackBuildInfo
115130
build = exe.buildInfo
131+
132+
names :: [DotCabalDescriptor]
116133
names =
117134
map DotCabalModule build.otherModules ++ [DotCabalMain exe.modulePath]
118135

@@ -124,13 +141,24 @@ stackLibraryFiles ::
124141
stackLibraryFiles lib =
125142
resolveComponentFiles componentName build names
126143
where
144+
componentRawName :: StackUnqualCompName
127145
componentRawName = lib.name
146+
147+
componentName :: NamedComponent
128148
componentName
129149
| componentRawName == emptyCompName = CLib
130150
| otherwise = CSubLib componentRawName
151+
152+
build :: StackBuildInfo
131153
build = lib.buildInfo
154+
155+
names :: [DotCabalDescriptor]
132156
names = bnames ++ exposed
157+
158+
exposed :: [DotCabalDescriptor]
133159
exposed = map DotCabalModule lib.exposedModules
160+
161+
bnames :: [DotCabalDescriptor]
134162
bnames = map DotCabalModule build.otherModules
135163

136164
-- | Get all files referenced by the component.
@@ -154,6 +182,7 @@ resolveComponentFiles component build names = do
154182
cfiles <- buildOtherSources build
155183
pure (component, ComponentFile modules (files <> cfiles) warnings)
156184
where
185+
autogenDirs :: RIO GetPackageFileContext [Path Abs Dir]
157186
autogenDirs = do
158187
distDir <- asks (.distDir)
159188
let compDir = componentAutogenDir component distDir

src/Stack/PackageFile.hs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,19 @@ resolveGlobFiles ::
8686
resolveGlobFiles cabalFileVersion =
8787
fmap (S.fromList . concatMap catMaybes) . mapM resolve
8888
where
89+
resolve :: FilePath -> RIO GetPackageFileContext [Maybe (Path Abs File)]
8990
resolve name =
9091
if '*' `elem` name
9192
then explode name
9293
else fmap pure (resolveFileOrWarn name)
94+
95+
explode :: FilePath -> RIO GetPackageFileContext [Maybe (Path Abs File)]
9396
explode name = do
9497
dir <- asks (parent . (.file))
9598
names <- matchDirFileGlob' (toFilePath dir) name
9699
mapM resolveFileOrWarn names
100+
101+
matchDirFileGlob' :: FilePath -> FilePath -> RIO GetPackageFileContext [FilePath]
97102
matchDirFileGlob' dir glob =
98103
catch
99104
(liftIO (matchDirFileGlob minBound cabalFileVersion dir glob))

0 commit comments

Comments
 (0)