Commit 77c2ce1e authored by Mikhail Glushenkov's avatar Mikhail Glushenkov
Browse files

Add a key-value map to the Compiler type.

parent 809ba758
......@@ -79,13 +79,19 @@ import Language.Haskell.Extension (Language(Haskell98), Extension)
import Control.Monad (liftM)
import Data.List (nub)
import qualified Data.Map as M (Map)
import Data.Maybe (catMaybes, isNothing)
import System.Directory (canonicalizePath)
data Compiler = Compiler {
compilerId :: CompilerId,
-- ^ Compiler flavour and version.
compilerLanguages :: [(Language, Flag)],
compilerExtensions :: [(Extension, Flag)]
-- ^ Supported language standards.
compilerExtensions :: [(Extension, Flag)],
-- ^ Supported extensions.
compilerProperties :: M.Map String String
-- ^ A key-value map for properties not covered by the above fields.
}
deriving (Show, Read)
......
......@@ -129,6 +129,7 @@ import Language.Haskell.Extension (Language(..), Extension(..)
import Control.Monad ( unless, when )
import Data.Char ( isSpace )
import Data.List
import qualified Data.Map as M ( empty )
import Data.Maybe ( catMaybes, fromMaybe )
import Data.Monoid ( Monoid(..) )
import System.Directory
......@@ -184,7 +185,8 @@ configure verbosity hcPath hcPkgPath conf0 = do
let comp = Compiler {
compilerId = CompilerId GHC ghcVersion,
compilerLanguages = languages,
compilerExtensions = extensions
compilerExtensions = extensions,
compilerProperties = M.empty
}
compPlatform = targetPlatform ghcInfo
conf4 = configureToolchain ghcProg ghcInfo conf3 -- configure gcc and ld
......
......@@ -108,6 +108,7 @@ import Distribution.ParseUtils
import Distribution.Verbosity
import Data.Char ( isSpace )
import qualified Data.Map as M ( empty )
import Data.Maybe ( mapMaybe, catMaybes )
import Data.Monoid ( Monoid(..) )
import Control.Monad ( unless, when, filterM )
......@@ -138,7 +139,8 @@ configure verbosity hcPath _hcPkgPath conf = do
let comp = Compiler {
compilerId = CompilerId Hugs version,
compilerLanguages = hugsLanguages,
compilerExtensions = hugsLanguageExtensions
compilerExtensions = hugsLanguageExtensions,
compilerProperties = M.empty
}
compPlatform = Nothing
return (comp, compPlatform, conf'')
......
......@@ -88,6 +88,7 @@ import Distribution.System ( Platform )
import Data.List ( nub )
import Data.Char ( isSpace )
import qualified Data.Map as M ( empty )
import Data.Maybe ( fromMaybe )
import qualified Data.ByteString.Lazy.Char8 as BS.Char8
......@@ -108,7 +109,8 @@ configure verbosity hcPath _hcPkgPath conf = do
comp = Compiler {
compilerId = CompilerId JHC version,
compilerLanguages = jhcLanguages,
compilerExtensions = jhcLanguageExtensions
compilerExtensions = jhcLanguageExtensions,
compilerProperties = M.empty
}
compPlatform = Nothing
return (comp, compPlatform, conf')
......
......@@ -116,6 +116,7 @@ import Language.Haskell.Extension
import Control.Monad ( unless, when )
import Data.List
import qualified Data.Map as M ( empty )
import Data.Maybe ( catMaybes )
import Data.Monoid ( Monoid(..) )
import System.Directory ( removeFile, renameFile,
......@@ -155,7 +156,8 @@ configure verbosity hcPath hcPkgPath conf = do
let comp = Compiler {
compilerId = CompilerId LHC lhcVersion,
compilerLanguages = languages,
compilerExtensions = extensions
compilerExtensions = extensions,
compilerProperties = M.empty
}
conf''' = configureToolchain lhcProg conf'' -- configure gcc and ld
compPlatform = Nothing
......
......@@ -98,11 +98,12 @@ import System.Directory
( doesFileExist, doesDirectoryExist, getDirectoryContents
, removeFile, getHomeDirectory )
import Data.Char ( toLower )
import Data.List ( nub )
import Data.Maybe ( catMaybes )
import Data.Monoid ( Monoid(..) )
import Control.Monad ( when, unless )
import Data.Char ( toLower )
import Data.List ( nub )
import Data.Maybe ( catMaybes )
import qualified Data.Map as M ( empty )
import Data.Monoid ( Monoid(..) )
import Control.Monad ( when, unless )
import Distribution.Compat.Exception
import Distribution.System ( Platform )
......@@ -133,7 +134,8 @@ configure verbosity hcPath _hcPkgPath conf = do
let comp = Compiler {
compilerId = CompilerId NHC nhcVersion,
compilerLanguages = nhcLanguages,
compilerExtensions = nhcLanguageExtensions
compilerExtensions = nhcLanguageExtensions,
compilerProperties = M.empty
}
compPlatform = Nothing
return (comp, compPlatform, conf'''')
......
......@@ -53,6 +53,7 @@ module Distribution.Simple.UHC (
import Control.Monad
import Data.List
import qualified Data.Map as M ( empty )
import Distribution.Compat.ReadP
import Distribution.InstalledPackageInfo
import Distribution.Package
......@@ -86,7 +87,8 @@ configure verbosity hcPath _hcPkgPath conf = do
let comp = Compiler {
compilerId = CompilerId UHC uhcVersion,
compilerLanguages = uhcLanguages,
compilerExtensions = uhcLanguageExtensions
compilerExtensions = uhcLanguageExtensions,
compilerProperties = M.empty
}
compPlatform = Nothing
return (comp, compPlatform, conf')
......
Markdown is supported
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