Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
Cabal
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Glasgow Haskell Compiler
Packages
Cabal
Commits
bdfa62a4
Commit
bdfa62a4
authored
8 years ago
by
Duncan Coutts
Browse files
Options
Downloads
Patches
Plain Diff
Add util compilerCompatFlavor, and document compilerCompatVersion
parent
41714567
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Cabal/Distribution/Simple/Compiler.hs
+25
-0
25 additions, 0 deletions
Cabal/Distribution/Simple/Compiler.hs
with
25 additions
and
0 deletions
Cabal/Distribution/Simple/Compiler.hs
+
25
−
0
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
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment