Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
An implementation of the Semantic Versioning Constraints. In absence of a standard around constraints, the behavior of node-semver is closely followed. The behavior is outlined here: https://github.com/npm/node-semver#ranges
Synopsis
- data Constraint
- = CAny
- | CLt !Version
- | CLtEq !Version
- | CGt !Version
- | CGtEq !Version
- | CEq !Version
- | CAnd !Constraint !Constraint
- | COr !Constraint !Constraint
- satisfies :: Version -> Constraint -> Bool
- fromText :: Text -> Either String Constraint
Documentation
data Constraint Source #
CAny | |
CLt !Version | |
CLtEq !Version | |
CGt !Version | |
CGtEq !Version | |
CEq !Version | |
CAnd !Constraint !Constraint | |
COr !Constraint !Constraint |
Instances
Eq Constraint Source # | |
Defined in Data.SemVer.Constraint (==) :: Constraint -> Constraint -> Bool # (/=) :: Constraint -> Constraint -> Bool # | |
Show Constraint Source # | |
Defined in Data.SemVer.Constraint showsPrec :: Int -> Constraint -> ShowS # show :: Constraint -> String # showList :: [Constraint] -> ShowS # |
satisfies :: Version -> Constraint -> Bool Source #
Checks whether the Version
satisfies the Constraint
Note: Semantics of this are strange in the presence of pre-release identifiers. Without a proper standard for how constraint satisfaction should behave, this implementation attempts to follow the behavior of node-semver which can be found here: https://github.com/npm/node-semver#prerelease-tags.
This choice was made because node-semver is the most widely deployed implementation of semantic versioning with the best documentation around how to treat pre-release identifiers.
The summary is that you must opt into using pre-release identifiers by specifying them in the constraint and they must match the exact version that attempts to use a pre-release identifier.
fromText :: Text -> Either String Constraint Source #
Parsing function to create a Constraint
from Text
according to the rules specified
here: https://github.com/npm/node-semver#ranges
Advanced syntax is not yet supported.