1- {-# LANGUAGE NoImplicitPrelude #-}
2- {-# LANGUAGE NoFieldSelectors #-}
3- {-# LANGUAGE OverloadedStrings #-}
1+ {-# LANGUAGE NoImplicitPrelude #-}
2+ {-# LANGUAGE NoFieldSelectors #-}
3+ {-# LANGUAGE OverloadedRecordDot #-}
4+ {-# LANGUAGE OverloadedStrings #-}
45
56module Stack.Types.Project
67 ( Project (.. )
@@ -21,7 +22,7 @@ data Project = Project
2122 , packages :: ! [RelFilePath ]
2223 -- ^ Packages which are actually part of the project (as opposed
2324 -- to dependencies).
24- , dependencies :: ! [RawPackageLocation ]
25+ , extraDeps :: ! [RawPackageLocation ]
2526 -- ^ Dependencies defined within the stack.yaml file, to be applied on top
2627 -- of the snapshot.
2728 , flagsByPkg :: ! (Map PackageName (Map FlagName Bool ))
@@ -42,16 +43,20 @@ data Project = Project
4243
4344instance ToJSON Project where
4445 -- Expanding the constructor fully to ensure we don't miss any fields.
45- toJSON (Project userMsg packages extraDeps flags resolver mcompiler extraPackageDBs mcurator drops) = object $ concat
46- [ maybe [] (\ cv -> [" compiler" .= cv]) mcompiler
47- , maybe [] (\ msg -> [" user-message" .= msg]) userMsg
48- , [ " extra-package-dbs" .= extraPackageDBs | not (null extraPackageDBs) ]
49- , [ " extra-deps" .= extraDeps | not (null extraDeps) ]
50- , [ " flags" .= fmap toCabalStringMap (toCabalStringMap flags)
51- | not (Map. null flags)
46+ toJSON project = object $ concat
47+ [ maybe [] (\ cv -> [" compiler" .= cv]) project. compiler
48+ , maybe [] (\ msg -> [" user-message" .= msg]) project. userMsg
49+ , [ " extra-package-dbs" .= project. extraPackageDBs
50+ | not (null project. extraPackageDBs)
51+ ]
52+ , [ " extra-deps" .= project. extraDeps | not (null project. extraDeps) ]
53+ , [ " flags" .= fmap toCabalStringMap (toCabalStringMap project. flagsByPkg)
54+ | not (Map. null project. flagsByPkg)
55+ ]
56+ , [" packages" .= project. packages]
57+ , [" resolver" .= project. resolver]
58+ , maybe [] (\ c -> [" curator" .= c]) project. curator
59+ , [ " drop-packages" .= Set. map CabalString project. dropPackages
60+ | not (Set. null project. dropPackages)
5261 ]
53- , [" packages" .= packages]
54- , [" resolver" .= resolver]
55- , maybe [] (\ c -> [" curator" .= c]) mcurator
56- , [ " drop-packages" .= Set. map CabalString drops | not (Set. null drops) ]
5762 ]
0 commit comments