@@ -174,14 +174,14 @@ insertCommonStanzas :: WriteOpts -> [PrettyField FieldAnnotation]
174174insertCommonStanzas opts =
175175 case specHasCommonStanzas $ _optCabalSpec opts of
176176 NoCommonStanzas -> [PrettyEmpty ]
177- _ ->
177+ _ ->
178178 [ field
179179 " import"
180180 (hsep . map text)
181181 [" extensions" ]
182182 [" Common language extensions" ]
183183 False
184- opts
184+ opts
185185 , field
186186 " import"
187187 (hsep . map text)
@@ -204,115 +204,117 @@ mkLibStanza opts (LibTarget srcDirs lang expMods otherMods exts deps tools) =
204204 annNoComments
205205 (toUTF8BS " library" )
206206 []
207- (insertCommonStanzas opts ++ [
208- field
209- " exposed-modules"
210- formatExposedModules
211- (toList expMods)
212- [" Modules exported by the library." ]
213- True
214- opts
215- , field
216- " other-modules"
217- formatOtherModules
218- otherMods
219- [" Modules included in this library but not exported." ]
220- True
221- opts
222- , field
223- " other-extensions"
224- formatOtherExtensions
225- exts
226- [" LANGUAGE extensions used by modules in this package." ]
227- True
228- opts
229- , field
230- " build-depends"
231- formatDependencyList
232- deps
233- [" Other library packages from which modules are imported." ]
234- True
235- opts
236- , field
237- " hs-source-dirs"
238- formatHsSourceDirs
239- (makeSymbolicPath <$> srcDirs)
240- [" Directories containing source files." ]
241- True
242- opts
243- , field
244- (buildToolTag opts)
245- formatDependencyList
246- tools
247- [" Extra tools (e.g. alex, hsc2hs, ...) needed to build the source." ]
248- False
249- opts
250- , field
251- " default-language"
252- id
253- lang
254- [" Base language which the package is written in." ]
255- True
256- opts
257- ])
207+ ( insertCommonStanzas opts
208+ ++ [ field
209+ " exposed-modules"
210+ formatExposedModules
211+ (toList expMods)
212+ [" Modules exported by the library." ]
213+ True
214+ opts
215+ , field
216+ " other-modules"
217+ formatOtherModules
218+ otherMods
219+ [" Modules included in this library but not exported." ]
220+ True
221+ opts
222+ , field
223+ " other-extensions"
224+ formatOtherExtensions
225+ exts
226+ [" LANGUAGE extensions used by modules in this package." ]
227+ True
228+ opts
229+ , field
230+ " build-depends"
231+ formatDependencyList
232+ deps
233+ [" Other library packages from which modules are imported." ]
234+ True
235+ opts
236+ , field
237+ " hs-source-dirs"
238+ formatHsSourceDirs
239+ (makeSymbolicPath <$> srcDirs)
240+ [" Directories containing source files." ]
241+ True
242+ opts
243+ , field
244+ (buildToolTag opts)
245+ formatDependencyList
246+ tools
247+ [" Extra tools (e.g. alex, hsc2hs, ...) needed to build the source." ]
248+ False
249+ opts
250+ , field
251+ " default-language"
252+ id
253+ lang
254+ [" Base language which the package is written in." ]
255+ True
256+ opts
257+ ]
258+ )
258259
259260mkExeStanza :: WriteOpts -> ExeTarget -> PrettyField FieldAnnotation
260261mkExeStanza opts (ExeTarget exeMain appDirs lang otherMods exts deps tools) =
261262 PrettySection
262263 annNoComments
263264 (toUTF8BS " executable" )
264265 [exeName]
265- (insertCommonStanzas opts ++ [
266- field
267- " main-is"
268- unsafeFromHs
269- exeMain
270- [" .hs or .lhs file containing the Main module." ]
271- True
272- opts
273- , field
274- " other-modules"
275- formatOtherModules
276- otherMods
277- [" Modules included in this executable, other than Main." ]
278- True
279- opts
280- , field
281- " other-extensions"
282- formatOtherExtensions
283- exts
284- [" LANGUAGE extensions used by modules in this package." ]
285- True
286- opts
287- , field
288- " build-depends"
289- formatDependencyList
290- deps
291- [" Other library packages from which modules are imported." ]
292- True
293- opts
294- , field
295- " hs-source-dirs"
296- formatHsSourceDirs
297- (makeSymbolicPath <$> appDirs)
298- [" Directories containing source files." ]
299- True
300- opts
301- , field
302- (buildToolTag opts)
303- formatDependencyList
304- tools
305- [" Extra tools (e.g. alex, hsc2hs, ...) needed to build the source." ]
306- False
307- opts
308- , field
309- " default-language"
310- id
311- lang
312- [" Base language which the package is written in." ]
313- True
314- opts
315- ])
266+ ( insertCommonStanzas opts
267+ ++ [ field
268+ " main-is"
269+ unsafeFromHs
270+ exeMain
271+ [" .hs or .lhs file containing the Main module." ]
272+ True
273+ opts
274+ , field
275+ " other-modules"
276+ formatOtherModules
277+ otherMods
278+ [" Modules included in this executable, other than Main." ]
279+ True
280+ opts
281+ , field
282+ " other-extensions"
283+ formatOtherExtensions
284+ exts
285+ [" LANGUAGE extensions used by modules in this package." ]
286+ True
287+ opts
288+ , field
289+ " build-depends"
290+ formatDependencyList
291+ deps
292+ [" Other library packages from which modules are imported." ]
293+ True
294+ opts
295+ , field
296+ " hs-source-dirs"
297+ formatHsSourceDirs
298+ (makeSymbolicPath <$> appDirs)
299+ [" Directories containing source files." ]
300+ True
301+ opts
302+ , field
303+ (buildToolTag opts)
304+ formatDependencyList
305+ tools
306+ [" Extra tools (e.g. alex, hsc2hs, ...) needed to build the source." ]
307+ False
308+ opts
309+ , field
310+ " default-language"
311+ id
312+ lang
313+ [" Base language which the package is written in." ]
314+ True
315+ opts
316+ ]
317+ )
316318 where
317319 exeName = pretty $ _optPkgName opts
318320
@@ -322,73 +324,75 @@ mkTestStanza opts (TestTarget testMain dirs lang otherMods exts deps tools) =
322324 annNoComments
323325 (toUTF8BS " test-suite" )
324326 [suiteName]
325- (insertCommonStanzas ++ [ case specHasCommonStanzas $ _optCabalSpec opts of
326- NoCommonStanzas -> PrettyEmpty
327- _ ->
328- field
329- " import"
330- (hsep . map text)
331- [" warnings" ]
332- [" Import common warning flags." ]
333- False
334- opts
335- , field
336- " default-language"
337- id
338- lang
339- [" Base language which the package is written in." ]
340- True
341- opts
342- , field
343- " other-modules"
344- formatOtherModules
345- otherMods
346- [" Modules included in this executable, other than Main." ]
347- True
348- opts
349- , field
350- " other-extensions"
351- formatOtherExtensions
352- exts
353- [" LANGUAGE extensions used by modules in this package." ]
354- True
355- opts
356- , field
357- " type"
358- text
359- " exitcode-stdio-1.0"
360- [" The interface type and version of the test suite." ]
361- True
362- opts
363- , field
364- " hs-source-dirs"
365- formatHsSourceDirs
366- (makeSymbolicPath <$> dirs)
367- [" Directories containing source files." ]
368- True
369- opts
370- , field
371- " main-is"
372- unsafeFromHs
373- testMain
374- [" The entrypoint to the test suite." ]
375- True
376- opts
377- , field
378- " build-depends"
379- formatDependencyList
380- deps
381- [" Test dependencies." ]
382- True
383- opts
384- , field
385- (buildToolTag opts)
386- formatDependencyList
387- tools
388- [" Extra tools (e.g. alex, hsc2hs, ...) needed to build the source." ]
389- False
390- opts
391- ]
327+ ( insertCommonStanzas opts
328+ ++ [ case specHasCommonStanzas $ _optCabalSpec opts of
329+ NoCommonStanzas -> PrettyEmpty
330+ _ ->
331+ field
332+ " import"
333+ (hsep . map text)
334+ [" warnings" ]
335+ [" Import common warning flags." ]
336+ False
337+ opts
338+ , field
339+ " default-language"
340+ id
341+ lang
342+ [" Base language which the package is written in." ]
343+ True
344+ opts
345+ , field
346+ " other-modules"
347+ formatOtherModules
348+ otherMods
349+ [" Modules included in this executable, other than Main." ]
350+ True
351+ opts
352+ , field
353+ " other-extensions"
354+ formatOtherExtensions
355+ exts
356+ [" LANGUAGE extensions used by modules in this package." ]
357+ True
358+ opts
359+ , field
360+ " type"
361+ text
362+ " exitcode-stdio-1.0"
363+ [" The interface type and version of the test suite." ]
364+ True
365+ opts
366+ , field
367+ " hs-source-dirs"
368+ formatHsSourceDirs
369+ (makeSymbolicPath <$> dirs)
370+ [" Directories containing source files." ]
371+ True
372+ opts
373+ , field
374+ " main-is"
375+ unsafeFromHs
376+ testMain
377+ [" The entrypoint to the test suite." ]
378+ True
379+ opts
380+ , field
381+ " build-depends"
382+ formatDependencyList
383+ deps
384+ [" Test dependencies." ]
385+ True
386+ opts
387+ , field
388+ (buildToolTag opts)
389+ formatDependencyList
390+ tools
391+ [" Extra tools (e.g. alex, hsc2hs, ...) needed to build the source." ]
392+ False
393+ opts
394+ ]
395+ )
392396 where
393397 suiteName = text $ unPackageName (_optPkgName opts) ++ " -test"
394398
0 commit comments