Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
Packages
Cabal
Commits
bdfa62a4
Commit
bdfa62a4
authored
Apr 24, 2016
by
Duncan Coutts
Browse files
Add util compilerCompatFlavor, and document compilerCompatVersion
parent
41714567
Changes
1
Hide whitespace changes
Inline
Side-by-side
Cabal/Distribution/Simple/Compiler.hs
View file @
bdfa62a4
...
...
@@ -26,6 +26,7 @@ module Distribution.Simple.Compiler (
Compiler
(
..
),
showCompilerId
,
showCompilerIdWithAbi
,
compilerFlavor
,
compilerVersion
,
compilerCompatFlavor
,
compilerCompatVersion
,
compilerInfo
,
...
...
@@ -112,6 +113,30 @@ compilerFlavor = (\(CompilerId f _) -> f) . compilerId
compilerVersion
::
Compiler
->
Version
compilerVersion
=
(
\
(
CompilerId
_
v
)
->
v
)
.
compilerId
-- | Is this compiler compatible with the compiler flavour we're interested in?
--
-- For example this checks if the compiler is actually GHC or is another
-- compiler that claims to be compatible with some version of GHC, e.g. GHCJS.
--
-- > if compilerCompatFlavor GHC compiler then ... else ...
--
compilerCompatFlavor
::
CompilerFlavor
->
Compiler
->
Bool
compilerCompatFlavor
flavor
comp
=
flavor
==
compilerFlavor
comp
||
flavor
`
elem
`
[
flavor'
|
CompilerId
flavor'
_
<-
compilerCompat
comp
]
-- | Is this compiler compatible with the compiler flavour we're interested in,
-- and if so what version does it claim to be compatible with.
--
-- For example this checks if the compiler is actually GHC-7.x or is another
-- compiler that claims to be compatible with some GHC-7.x version.
--
-- > case compilerCompatVersion GHC compiler of
-- > Just (Version (7:_)) -> ...
-- > _ -> ...
--
compilerCompatVersion
::
CompilerFlavor
->
Compiler
->
Maybe
Version
compilerCompatVersion
flavor
comp
|
compilerFlavor
comp
==
flavor
=
Just
(
compilerVersion
comp
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment