-- 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.1.2 -- | 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, common manipulations, and serialisation primitives. module Data.SemVer -- | A type representing an individual identifier from the release or -- metadata components of a Version. -- -- data Identifier INum :: !Int -> Identifier IText :: !Text -> Identifier -- | A type representing a successfully decoded or constructed semantic -- version. -- -- data Version Version :: !Int -> !Int -> !Int -> [Identifier] -> [Identifier] -> Version -- | The major version component. _versionMajor :: Version -> !Int -- | The minor version component. _versionMinor :: Version -> !Int -- | The patch level component. _versionPatch :: Version -> !Int -- | A (potentially empty) list of release identifiers. _versionRelease :: Version -> [Identifier] -- | A (potentially empty) list of metadata. _versionMeta :: Version -> [Identifier] -- | A default Version which can be used to signify initial -- development. -- -- Note: Equivalent to 0.0.0 defaultVersion :: Version versionMajor :: Functor f => (Int -> f Int) -> Version -> f Version versionMinor :: Functor f => (Int -> f Int) -> Version -> f Version versionPatch :: Functor f => (Int -> f Int) -> Version -> f Version versionRelease :: Functor f => ([Identifier] -> f [Identifier]) -> Version -> f Version versionMeta :: Functor f => ([Identifier] -> f [Identifier]) -> Version -> f Version -- | Increment the major component of a Version by 1, resetting the -- minor and patch components. -- -- incrementMajor :: Version -> Version -- | Increment the minor component of a Version by 1, resetting the -- patch component. -- -- incrementMinor :: Version -> Version -- | Increment the patch component of a Version by 1. -- -- incrementPatch :: Version -> Version -- | Check if the Version is considered unstable. -- -- 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 set of delimiters used to encode/decode a Version and -- specifyc alternative serialisation strategies. -- -- Example: using alpha characters to encode the version as a valid DNS -- CNAME, such as: -- --
--    let Right v = fromText 1.2.3+40
--    let alpha   = Delimiters 'm' 'p' 'r' 'd' 'i'
--   
--   Data.Text.Lazy.Builder.toLazyText ("app01-"  toDelimitedBuilder alpha v  ".dmz.internal")
--   
-- -- Would result in the following Text: -- --
--   app01-1m2p3d40.dmz.internal
--   
-- -- Using the same Delimiters set with delimitedParser would -- ensure correct decoding behaviour. data Delimiters Delimiters :: !Char -> !Char -> !Char -> !Char -> !Char -> Delimiters _delimMinor :: Delimiters -> !Char _delimPatch :: Delimiters -> !Char _delimRelease :: Delimiters -> !Char _delimMeta :: Delimiters -> !Char _delimIdent :: Delimiters -> !Char -- | 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
--   
defaultDelimiters :: Delimiters delimMinor :: Functor f => (Char -> f Char) -> Delimiters -> f Delimiters delimPatch :: Functor f => (Char -> f Char) -> Delimiters -> f Delimiters delimRelease :: Functor f => (Char -> f Char) -> Delimiters -> f Delimiters delimMeta :: Functor f => (Char -> f Char) -> Delimiters -> f Delimiters 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 Typeable Identifier instance Typeable Version instance Typeable Delimiters instance Eq Identifier instance Read Identifier instance Show Identifier instance Generic Identifier instance Eq Version instance Read Version instance Show Version instance Generic Version instance Eq Delimiters instance Ord Delimiters instance Read Delimiters instance Show Delimiters instance Generic Delimiters instance Datatype D1Identifier instance Constructor C1_0Identifier instance Constructor C1_1Identifier instance Datatype D1Version instance Constructor C1_0Version instance Selector S1_0_0Version instance Selector S1_0_1Version instance Selector S1_0_2Version instance Selector S1_0_3Version instance Selector S1_0_4Version instance Datatype D1Delimiters instance Constructor C1_0Delimiters instance Selector S1_0_0Delimiters instance Selector S1_0_1Delimiters instance Selector S1_0_2Delimiters instance Selector S1_0_3Delimiters instance Selector S1_0_4Delimiters instance NFData Delimiters instance NFData Version instance Ord Version instance NFData Identifier instance Ord Identifier