-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Representation, manipulation, and de/serialisation of Semantic Versions.
--
-- Representation, manipulation, and de/serialisation of a Version type
-- following the Semantic Versioning specification.
--
-- For more information see: http://semver.org
@package semver
@version 0.2.0
-- | An implementation of the Semantic Versioning specification located at
-- http://semver.org.
--
-- A canonical Version type and functions representing behaviour
-- as outlined in the specification are defined alongside additional
-- lenses, traversals, common manipulations, and serialisation
-- primitives.
module Data.SemVer
-- | An opaque type representing a successfully decoded or constructed
-- semantic version. See the related functions and lenses for
-- modification and update.
--
--
-- - The Eq instance represents exhaustive equality with all
-- components considered.
-- - The Ord instance implements the precedence rules from the
-- semantic version specification with metadata being ignored.
--
data Version
-- | Smart constructor fully specifying all available version components.
version :: Int -> Int -> Int -> [Identifier] -> [Identifier] -> Version
-- | A default Version which can be used to signify initial
-- development.
--
-- Note: Equivalent to 0.0.0
initial :: Version
-- | Lens for the major version component.
versionMajor :: Functor f => (Int -> f Int) -> Version -> f Version
-- | Lens for minor version component.
versionMinor :: Functor f => (Int -> f Int) -> Version -> f Version
-- | Lens for the patch version component.
versionPatch :: Functor f => (Int -> f Int) -> Version -> f Version
-- | Lens for the list of release identifiers.
versionRelease :: Functor f => ([Identifier] -> f [Identifier]) -> Version -> f Version
-- | Lens for the list of metadata identifiers.
versionMeta :: Functor f => ([Identifier] -> f [Identifier]) -> Version -> f Version
-- | Increment the major component of a Version by 1, resetting the
-- minor and patch components.
--
--
-- - Major version X (X.y.z | X > 0) MUST be incremented if any
-- backwards incompatible changes are introduced to the public API.
-- - It MAY include minor and patch level changes.
-- - Patch and minor version MUST be reset to 0 when major version is
-- incremented.
--
incrementMajor :: Version -> Version
-- | Increment the minor component of a Version by 1, resetting the
-- patch component.
--
--
-- - Minor version Y (x.Y.z | x > 0) MUST be incremented if new,
-- backwards compatible functionality is introduced to the public
-- API.
-- - It MUST be incremented if any public API functionality is marked
-- as deprecated.
-- - It MAY be incremented if substantial new functionality or
-- improvements are introduced within the private code.
-- - It MAY include patch level changes.
-- - Patch version MUST be reset to 0 when minor version is
-- incremented.
--
incrementMinor :: Version -> Version
-- | Increment the patch component of a Version by 1.
--
--
-- - Patch version Z (x.y.Z | x > 0) MUST be incremented if only
-- backwards compatible bug fixes are introduced.
-- - A bug fix is defined as an internal change that fixes incorrect
-- behavior.
--
incrementPatch :: Version -> Version
-- | Check if the Version is considered unstable.
--
--
-- - Major version zero (0.y.z) is for initial development.
-- - Anything may change at any time.
-- - The public API should not be considered stable.
--
isDevelopment :: Version -> Bool
-- | Check if the Version is considered stable.
--
-- Version 1.0.0 defines the public API. The way in which the version
-- number is incremented after this release is dependent on this public
-- API and how it changes.
isPublic :: Version -> Bool
-- | Convert a Version to it's readable String
-- representation.
--
-- Note: This is optimised for cases where you wish to use a
-- String and as such is faster than the semantically equivalent
-- unpack . toLazyText.
toString :: Version -> String
-- | Convert a Version to a strict Text representation.
--
-- Note: Equivalent to toStrict . toLazyText
toText :: Version -> Text
-- | Convert a Version to a Text representation.
--
-- Note: This uses a lower Builder buffer size optimised for
-- commonly found version formats. If you have particuarly long version
-- numbers using toBuilder and toLazyTextWith to control
-- the buffer size is recommended.
toLazyText :: Version -> Text
-- | Convert a Version to a Builder.
toBuilder :: Version -> Builder
-- | Parse a Version from Text, returning an attoparsec error
-- message in the Left case on failure.
fromText :: Text -> Either String Version
-- | Parse a Version from Text, returning an attoparsec error
-- message in the Left case on failure.
--
-- Note: The underlying attoparsec Parser is based on Text
-- and this is equivalent to fromText . toStrict
fromLazyText :: Text -> Either String Version
-- | A greedy attoparsec Parser which requires the entire
-- Text input to match.
parser :: Parser Version
-- | A type representing an individual identifier from the release or
-- metadata components of a Version.
--
--
-- - The Ord instance implements precedence according to the
-- semantic version specification, with numeric identifiers being of
-- lower precedence than textual identifiers, otherwise
-- lexicographic ordering is used.
--
--
-- The functions numeric and textual can be used to
-- construct an Identifier.
data Identifier
-- | Safely construct a numeric identifier.
numeric :: Int -> Identifier
-- | Construct an identifier from the given Text, returning
-- Nothing if neither a numeric or valid textual input is
-- supplied.
textual :: Text -> Maybe Identifier
_Numeric :: Applicative f => (Int -> f Int) -> Identifier -> f Identifier
_Textual :: Applicative f => (Text -> f Text) -> Identifier -> f Identifier
-- | An opaque set representing the seperators used to delimit semantic
-- version components.
data Delimiters
-- | The default set of delimiters used in the semantic version
-- specification.
--
-- Example: Given exhaustive version components would result in the
-- following hypothetical version:
--
--
-- 1.2.3-alpha.1+sha.exp.12ab3d9
--
delimiters :: Delimiters
-- | Lens for the minor version delimiter. Default: .
delimMinor :: Functor f => (Char -> f Char) -> Delimiters -> f Delimiters
-- | Lens for the patch version delimiter. Default: .
delimPatch :: Functor f => (Char -> f Char) -> Delimiters -> f Delimiters
-- | Lens for the release component delimiter. Default: -
delimRelease :: Functor f => (Char -> f Char) -> Delimiters -> f Delimiters
-- | Lens for the metadata component delimiter. Default: +
delimMeta :: Functor f => (Char -> f Char) -> Delimiters -> f Delimiters
-- | Lens for the individual identifier delimiter. Default: .
delimIdent :: Functor f => (Char -> f Char) -> Delimiters -> f Delimiters
-- | Convert a Version to a Builder using the specified
-- Delimiters set.
toDelimitedBuilder :: Delimiters -> Version -> Builder
-- | A greedy attoparsec Parser using the specified
-- Delimiters set which requires the entire Text input to
-- match.
delimitedParser :: Delimiters -> Parser Version
instance Eq Identifier
instance Show Identifier
instance Eq Version
instance Show Version
instance Eq Delimiters
instance Ord Delimiters
instance Show Delimiters
instance NFData Delimiters
instance NFData Version
instance Ord Version
instance NFData Identifier
instance Ord Identifier