Commit 7811f78f authored by kristenk's avatar kristenk
Browse files

Allow a compiler to support zero languages or extensions in the solver DSL.

'DSL.exResolve' now takes a 'Maybe [Extension]' for supported extensions and
a 'Maybe [Language]' for supported languages.  'Nothing' means that
extensions/languages are not checked by the solver, and 'Just []' means that
no extensions/languages are allowed.
parent f0ccd6c3
......@@ -333,10 +333,10 @@ exInstIdx :: [ExampleInstalled] -> C.PackageIndex.InstalledPackageIndex
exInstIdx = C.PackageIndex.fromList . map exInstInfo
exResolve :: ExampleDb
-- List of extensions supported by the compiler.
-> [Extension]
-- A compiler can support multiple languages.
-> [Language]
-- List of extensions supported by the compiler, or Nothing if unknown.
-> Maybe [Extension]
-- List of languages supported by the compiler, or Nothing if unknown.
-> Maybe [Language]
-> [ExamplePkgName]
-> Bool
-> [ExPreference]
......@@ -348,12 +348,8 @@ exResolve db exts langs targets indepGoals prefs = runProgress $
params
where
defaultCompiler = C.unknownCompilerInfo C.buildCompilerId C.NoAbiTag
compiler = defaultCompiler { C.compilerInfoExtensions = if null exts
then Nothing
else Just exts
, C.compilerInfoLanguages = if null langs
then Nothing
else Just langs
compiler = defaultCompiler { C.compilerInfoExtensions = exts
, C.compilerInfoLanguages = langs
}
(inst, avai) = partitionEithers db
instIdx = exInstIdx inst
......
......@@ -120,8 +120,8 @@ data SolverTest = SolverTest {
, testIndepGoals :: Bool
, testSoftConstraints :: [ExPreference]
, testDb :: ExampleDb
, testSupportedExts :: [Extension]
, testSupportedLangs :: [Language]
, testSupportedExts :: Maybe [Extension]
, testSupportedLangs :: Maybe [Language]
}
mkTest :: ExampleDb
......@@ -129,7 +129,7 @@ mkTest :: ExampleDb
-> [String]
-> Maybe [(String, Int)]
-> SolverTest
mkTest = mkTestExtLang [] []
mkTest = mkTestExtLang Nothing Nothing
mkTestExts :: [Extension]
-> ExampleDb
......@@ -137,7 +137,7 @@ mkTestExts :: [Extension]
-> [String]
-> Maybe [(String, Int)]
-> SolverTest
mkTestExts exts = mkTestExtLang exts []
mkTestExts exts = mkTestExtLang (Just exts) Nothing
mkTestLangs :: [Language]
-> ExampleDb
......@@ -145,10 +145,10 @@ mkTestLangs :: [Language]
-> [String]
-> Maybe [(String, Int)]
-> SolverTest
mkTestLangs = mkTestExtLang []
mkTestLangs = mkTestExtLang Nothing . Just
mkTestExtLang :: [Extension]
-> [Language]
mkTestExtLang :: Maybe [Extension]
-> Maybe [Language]
-> ExampleDb
-> String
-> [String]
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment