diff options
author | Ben Gamari <ben@smart-cactus.org> | 2020-11-11 14:41:16 -0500 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-11-22 12:39:38 -0500 |
commit | d23fef68415ce6587f77e9530cb0571bb90b31cc (patch) | |
tree | c4aee9c532bceeca6c37b5b5b03ce108d9139805 /hadrian/src/Settings.hs | |
parent | 92c0afbf592e71dae3c80cec09b1596df50ff8a9 (diff) | |
download | haskell-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-x | hadrian/src/Settings.hs | 8 |
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. |