packages feed

semver 0.3.0 → 0.3.1

raw patch · 3 files changed

+27/−15 lines, 3 filesdep ~attoparsecdep ~deepseqdep ~text

Dependency ranges changed: attoparsec, deepseq, text

Files

semver.cabal view
@@ -1,11 +1,11 @@ name:                  semver-version:               0.3.0+version:               0.3.1 synopsis:              Representation, manipulation, and de/serialisation of Semantic Versions. homepage:              https://github.com/brendanhay/semver license:               OtherLicense license-file:          LICENSE author:                Brendan Hay-maintainer:            brendan.g.hay@gmail.com+maintainer:            Brendan Hay <brendan.g.hay@gmail.com> copyright:             Copyright (c) 2014 Brendan Hay category:              Data build-type:            Simple@@ -35,17 +35,17 @@           Data.SemVer.Internal      build-depends:-          attoparsec >= 0.10 && < 0.13+          attoparsec >= 0.10         , base       >= 4.5  && < 5.0-        , deepseq    >= 1.1  && < 1.4-        , text       >= 0.11 && < 1.2+        , deepseq    >= 1.1+        , text       >= 0.11  benchmark semver-bench     type:              exitcode-stdio-1.0     default-language:  Haskell2010     main-is:           Main.hs     hs-source-dirs:    bench-    ghc-options:      -Wall -O2 -threaded -with-rtsopts=-T+    ghc-options:       -Wall -O2 -threaded -with-rtsopts=-T      build-depends:           base
src/Data/SemVer.hs view
@@ -98,17 +98,17 @@  -- | Lens for the list of release identifiers. release :: Functor f-               => ([Identifier] -> f [Identifier])-               -> Version-               -> f Version+        => ([Identifier] -> f [Identifier])+        -> Version+        -> f Version release f x = (\y -> x { _versionRelease = y }) <$> f (_versionRelease x) {-# INLINE release #-}  -- | Lens for the list of metadata identifiers. metadata :: Functor f-            => ([Identifier] -> f [Identifier])-            -> Version-            -> f Version+         => ([Identifier] -> f [Identifier])+         -> Version+         -> f Version metadata f x = (\y -> x { _versionMeta = y }) <$> f (_versionMeta x) {-# INLINE metadata #-} @@ -136,6 +136,7 @@     , _versionMinor = 0     , _versionPatch = 0     }+{-# INLINE incrementMajor #-}  -- | Increment the minor component of a 'Version' by 1, resetting the -- patch component.@@ -157,6 +158,7 @@     { _versionMinor = _versionMinor v + 1     , _versionPatch = 0     }+{-# INLINE incrementMinor #-}  -- | Increment the patch component of a 'Version' by 1. --@@ -168,6 +170,7 @@ incrementPatch v = v     { _versionPatch = _versionPatch v + 1     }+{-# INLINE incrementPatch #-}  -- | Check if the 'Version' is considered unstable. --@@ -178,6 +181,7 @@ -- * The public API should not be considered stable. isDevelopment :: Version -> Bool isDevelopment = (== 0) . _versionMajor+{-# INLINE isDevelopment #-}  -- | Check if the 'Version' is considered stable. --@@ -186,6 +190,7 @@ -- it changes. isPublic :: Version -> Bool isPublic = (>= 1) . _versionMajor+{-# INLINE isPublic #-}  -- | Convert a 'Version' to it's readable 'String' representation. --@@ -193,12 +198,14 @@ -- as such is faster than the semantically equivalent @unpack . toLazyText@. toString :: Version -> String toString = toMonoid (:[]) show Text.unpack Delim.semantic+{-# INLINE toString #-}  -- | Convert a 'Version' to a strict 'Text' representation. -- -- Note: Equivalent to @toStrict . toLazyText@ toText :: Version -> Text toText = LText.toStrict . toLazyText+{-# INLINE toText #-}  -- | Convert a 'Version' to a 'LText.Text' representation. --@@ -208,15 +215,18 @@ -- is recommended. toLazyText :: Version -> LText.Text toLazyText = Build.toLazyTextWith 24 . toBuilder+{-# INLINE toLazyText #-}  -- | Convert a 'Version' to a 'Builder'. toBuilder :: Version -> Builder toBuilder = Delim.toBuilder Delim.semantic+{-# INLINE toBuilder #-}  -- | Parse a 'Version' from 'Text', returning an attoparsec error message -- in the 'Left' case on failure. fromText :: Text -> Either String Version fromText = parseOnly parser+{-# INLINE fromText #-}  -- | Parse a 'Version' from 'LText.Text', returning an attoparsec error message -- in the 'Left' case on failure.@@ -225,11 +235,13 @@ -- equivalent to @fromText . toStrict@ fromLazyText :: LText.Text -> Either String Version fromLazyText = fromText . LText.toStrict+{-# INLINE fromLazyText #-}  -- | A greedy attoparsec 'Parser' which requires the entire 'Text' -- input to match. parser :: Parser Version parser = Delim.parser Delim.semantic+{-# INLINE parser #-}  -- | Safely construct a numeric identifier. numeric :: Int -> Identifier
src/Data/SemVer/Delimited.hs view
@@ -19,10 +19,10 @@ -- DNS CNAME (assuming operators from lens or lens-family-core): -- -- @--- let Right v = fromText "1.2.3+40"+-- let Right v = fromText \"1.2.3+40\" -- let alpha = semantic & major .~ \'m\' & patch .~ \'p\' & release .~ \'r\' & metadata .~ \'d\' & identifier .~ \'i\' ----- Data.Text.Lazy.Builder.toLazyText (\"app01-\" <> toDelimitedBuilder alpha v <> \".dmz.internal\")+-- Data.Text.Lazy.Builder.toLazyText (\"app01-\" <> toBuilder alpha v <> \".dmz.internal\") -- @ -- -- Would result in the following 'LText.Text':@@ -31,7 +31,7 @@ -- app01-1m2p3d40.dmz.internal -- @ ----- Using the same 'Delimiters' set with 'delimitedParser' would ensure+-- Using the same 'Delimiters' set with 'parser' would ensure -- correct decoding behaviour. module Data.SemVer.Delimited     (