Skip to content
GitLab
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
7d0cefeb
Commit
7d0cefeb
authored
Dec 03, 2013
by
Mikhail Glushenkov
Browse files
New function: 'relaxUpperBound :: VersionRange -> VersionRange'.
parent
9a5b601b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Cabal/Distribution/Version.hs
View file @
7d0cefeb
...
...
@@ -68,6 +68,9 @@ module Distribution.Version (
foldVersionRange
,
foldVersionRange'
,
-- ** Modification
relaxUpperBound
,
-- * Version intervals view
asVersionIntervals
,
VersionInterval
,
...
...
@@ -237,6 +240,18 @@ betweenVersionsInclusive v1 v2 =
{-# DEPRECATED betweenVersionsInclusive
"In practice this is not very useful because we normally use inclusive lower bounds and exclusive upper bounds" #-}
-- | Given a version range, remove the highest upper bound. Example: @(>= 1 && <
-- 3) || (>= 4 && < 5)@ is converted to @(>= 1 && < 3) || (>= 4)@.
relaxUpperBound
::
VersionRange
->
VersionRange
relaxUpperBound
=
fromVersionIntervals
.
relaxLastInterval
.
toVersionIntervals
where
relaxLastInterval
(
VersionIntervals
intervals
)
=
VersionIntervals
(
relaxLastInterval'
intervals
)
relaxLastInterval'
[]
=
[]
relaxLastInterval'
[(
l
,
_
)]
=
[(
l
,
NoUpperBound
)]
relaxLastInterval'
(
i
:
is
)
=
i
:
relaxLastInterval'
is
-- | Fold over the basic syntactic structure of a 'VersionRange'.
--
-- This provides a syntacic view of the expression defining the version range.
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment