Skip to content

Commit cff7a61

Browse files
committed
Formatting.
1 parent 9e1976e commit cff7a61

File tree

1 file changed

+32
-29
lines changed

1 file changed

+32
-29
lines changed

Cabal/Distribution/Simple/ShowBuildInfo.hs

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,14 @@ import Distribution.Types.TargetInfo
7272
import Distribution.Text
7373
import Distribution.Pretty
7474

75-
-- | Construct a JSON document describing the build information for a package
76-
mkBuildInfo :: PackageDescription -- ^ Mostly information from the .cabal file
77-
-> LocalBuildInfo -- ^ Configuration information
78-
-> BuildFlags -- ^ Flags that the user passed to build
79-
-> [TargetInfo]
80-
-> Json
75+
-- | Construct a JSON document describing the build information for a
76+
-- package.
77+
mkBuildInfo
78+
:: PackageDescription -- ^ Mostly information from the .cabal file
79+
-> LocalBuildInfo -- ^ Configuration information
80+
-> BuildFlags -- ^ Flags that the user passed to build
81+
-> [TargetInfo]
82+
-> Json
8183
mkBuildInfo pkg_descr lbi _flags targetsToBuild = info
8284
where
8385
componentsToBuild = map (\target -> (componentLocalName $ targetCLBI target,targetCLBI target)) targetsToBuild
@@ -86,45 +88,45 @@ mkBuildInfo pkg_descr lbi _flags targetsToBuild = info
8688

8789
info = JsonObject
8890
[ "cabal-version" .= JsonString (display cabalVersion)
89-
, "compiler" .= mkCompilerInfo
90-
, "components" .= JsonArray (map mkComponentInfo componentsToBuild)
91+
, "compiler" .= mkCompilerInfo
92+
, "components" .= JsonArray (map mkComponentInfo componentsToBuild)
9193
]
9294

9395
mkCompilerInfo = JsonObject
94-
[ "flavour" .= JsonString (prettyShow $ compilerFlavor $ compiler lbi)
96+
[ "flavour" .= JsonString (prettyShow $ compilerFlavor $ compiler lbi)
9597
, "compiler-id" .= JsonString (showCompilerId $ compiler lbi)
96-
, "path" .= path
98+
, "path" .= path
9799
]
98100
where
99101
path = maybe JsonNull (JsonString . programPath)
100102
$ (flavorToProgram . compilerFlavor $ compiler lbi)
101103
>>= flip lookupProgram (withPrograms lbi)
102104

103105
flavorToProgram :: CompilerFlavor -> Maybe Program
104-
flavorToProgram GHC = Just ghcProgram
106+
flavorToProgram GHC = Just ghcProgram
105107
flavorToProgram GHCJS = Just ghcjsProgram
106-
flavorToProgram UHC = Just uhcProgram
107-
flavorToProgram JHC = Just jhcProgram
108-
flavorToProgram _ = Nothing
108+
flavorToProgram UHC = Just uhcProgram
109+
flavorToProgram JHC = Just jhcProgram
110+
flavorToProgram _ = Nothing
109111

110112
mkComponentInfo (name, clbi) = JsonObject
111-
[ "type" .= JsonString compType
112-
, "name" .= JsonString (prettyShow name)
113-
, "unit-id" .= JsonString (prettyShow $ componentUnitId clbi)
113+
[ "type" .= JsonString compType
114+
, "name" .= JsonString (prettyShow name)
115+
, "unit-id" .= JsonString (prettyShow $ componentUnitId clbi)
114116
, "compiler-args" .= JsonArray (map JsonString $ getCompilerArgs bi lbi clbi)
115-
, "modules" .= JsonArray (map (JsonString . display) modules)
116-
, "src-files" .= JsonArray (map JsonString sourceFiles)
117-
, "src-dirs" .= JsonArray (map JsonString $ hsSourceDirs bi)
117+
, "modules" .= JsonArray (map (JsonString . display) modules)
118+
, "src-files" .= JsonArray (map JsonString sourceFiles)
119+
, "src-dirs" .= JsonArray (map JsonString $ hsSourceDirs bi)
118120
]
119121
where
120122
bi = componentBuildInfo comp
121123
Just comp = lookupComponent pkg_descr name
122124
compType = case comp of
123-
CLib _ -> "lib"
124-
CExe _ -> "exe"
125-
CTest _ -> "test"
126-
CBench _ -> "bench"
127-
CFLib _ -> "flib"
125+
CLib _ -> "lib"
126+
CExe _ -> "exe"
127+
CTest _ -> "test"
128+
CBench _ -> "bench"
129+
CFLib _ -> "flib"
128130
modules = case comp of
129131
CLib lib -> explicitLibModules lib
130132
CExe exe -> exeModules exe
@@ -136,10 +138,11 @@ mkBuildInfo pkg_descr lbi _flags targetsToBuild = info
136138

137139
-- | Get the command-line arguments that would be passed
138140
-- to the compiler to build the given component.
139-
getCompilerArgs :: BuildInfo
140-
-> LocalBuildInfo
141-
-> ComponentLocalBuildInfo
142-
-> [String]
141+
getCompilerArgs
142+
:: BuildInfo
143+
-> LocalBuildInfo
144+
-> ComponentLocalBuildInfo
145+
-> [String]
143146
getCompilerArgs bi lbi clbi =
144147
case compilerFlavor $ compiler lbi of
145148
GHC -> ghc

0 commit comments

Comments
 (0)