summaryrefslogtreecommitdiff
path: root/hadrian/src/Settings.hs
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-11-11 14:41:16 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-11-22 12:39:38 -0500
commitd23fef68415ce6587f77e9530cb0571bb90b31cc (patch)
treec4aee9c532bceeca6c37b5b5b03ce108d9139805 /hadrian/src/Settings.hs
parent92c0afbf592e71dae3c80cec09b1596df50ff8a9 (diff)
downloadhaskell-d23fef68415ce6587f77e9530cb0571bb90b31cc.tar.gz
hadrian: Introduce notion of flavour transformers
This extends Hadrian's notion of "flavour", as described in #18942.
Diffstat (limited to 'hadrian/src/Settings.hs')
-rwxr-xr-xhadrian/src/Settings.hs8
1 files changed, 3 insertions, 5 deletions
diff --git a/hadrian/src/Settings.hs b/hadrian/src/Settings.hs
index ff51c01acb..43af1330ca 100755
--- a/hadrian/src/Settings.hs
+++ b/hadrian/src/Settings.hs
@@ -75,11 +75,9 @@ flavour = do
let flavours = hadrianFlavours ++ userFlavours
(_settingErrs, tweak) = applySettings kvs
- return $
- case filter (\fl -> name fl == flavourName) flavours of
- [] -> error $ "Unknown build flavour: " ++ flavourName
- [f] -> tweak f
- _ -> error $ "Multiple build flavours named " ++ flavourName
+ case parseFlavour flavours flavourTransformers flavourName of
+ Left err -> fail err
+ Right f -> return $ tweak f
-- TODO: switch to Set Package as the order of packages should not matter?
-- Otherwise we have to keep remembering to sort packages from time to time.