packages feed

human-readable-duration 0.2.1.4 → 0.2.1.5

raw patch · 3 files changed

+65/−79 lines, 3 filesdep ~timePVP ok

version bump matches the API change (PVP)

Dependency ranges changed: time

API changes (from Hackage documentation)

Files

LICENSE view
@@ -1,30 +1,21 @@-Copyright Example Yann Esposito (c) 2015--All rights reserved.--Redistribution and use in source and binary forms, with or without-modification, are permitted provided that the following conditions are met:+MIT License -    * Redistributions of source code must retain the above copyright-      notice, this list of conditions and the following disclaimer.+Copyright (c) 2015 Yann Esposito -    * Redistributions in binary form must reproduce the above-      copyright notice, this list of conditions and the following-      disclaimer in the documentation and/or other materials provided-      with the distribution.+Permission is hereby granted, free of charge, to any person obtaining a copy+of this software and associated documentation files (the "Software"), to deal+in the Software without restriction, including without limitation the rights+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+copies of the Software, and to permit persons to whom the Software is+furnished to do so, subject to the following conditions: -    * Neither the name of Yann Esposito nor the names of other-      contributors may be used to endorse or promote products derived-      from this software without specific prior written permission.+The above copyright notice and this permission notice shall be included in all+copies or substantial portions of the Software. -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE+SOFTWARE.
human-readable-duration.cabal view
@@ -1,12 +1,17 @@-cabal-version: >=1.10-name: human-readable-duration-version: 0.2.1.4-license: BSD3-license-file: LICENSE-maintainer: yann.esposito@gmail.com-author: Yann Esposito-homepage: https://gitlab.esy.fun/yogsototh/human-readable-duration#readme-synopsis: Provide duration helper+name:                human-readable-duration+version:             0.2.1.5+synopsis:            Provide duration helper+homepage:            https://gitlab.esy.fun/yogsototh/human-readable-duration#readme+license:             MIT+license-file:        LICENSE+author:              Yann Esposito+maintainer:          yann.esposito@gmail.com+category:            Time+build-type:          Simple+cabal-version:       >=1.10+extra-source-files:+  README.md+  stack.yaml description:     This is a minimal Haskell library to display duration.     .@@ -19,47 +24,37 @@     > -- will return 763     > getMs duration     > -- will return 65923323002-category: Time-build-type: Simple-extra-source-files:-    README.md-    stack.yaml -source-repository head-    type: git-    location: https://gitlab.esy.fun/yogsototh/human-readable-duration- library-    exposed-modules:-        Data.Duration-        Data.Duration.Tutorial-    hs-source-dirs: src-    default-language: Haskell2010-    ghc-options: -Wall -Wincomplete-uni-patterns-                 -Wredundant-constraints -Wnoncanonical-monad-instances-    build-depends:-        base >=4.7 && <5+  hs-source-dirs:      src+  exposed-modules:     Data.Duration+                       Data.Duration.Tutorial+  build-depends:       base >= 4.7 && < 5+  default-language:    Haskell2010+  ghc-options: -Wall -Wincomplete-uni-patterns -Wredundant-constraints -Wnoncanonical-monad-instances  test-suite doctest-    type: exitcode-stdio-1.0-    main-is: DocTest.hs-    hs-source-dirs: test-    default-language: Haskell2010-    ghc-options: -Wall-    build-depends:-        base >=4.7 && <5,-        Glob >=0.7,-        human-readable-duration -any,-        time >=1.8.0.2,-        doctest >=0.9.12+  type:                exitcode-stdio-1.0+  hs-source-dirs:      test+  main-is:             DocTest.hs+  build-depends:       base >= 4.7 && < 5+                     , Glob >= 0.7+                     , human-readable-duration+                     , time+                     , doctest >= 0.9.12+  ghc-options:         -Wall+  default-language:    Haskell2010  benchmark hrd-bench-    type: exitcode-stdio-1.0-    main-is: Main.hs-    hs-source-dirs: bench-    default-language: Haskell2010-    ghc-options: -Wall -threaded-    build-depends:-        base >=4.7 && <5,-        criterion >=1.1.0.0,-        human-readable-duration -any+  type: exitcode-stdio-1.0+  hs-source-dirs: bench+  main-is: Main.hs+  ghc-options: -Wall -threaded+  default-language: Haskell2010+  build-depends: base >= 4.7 && < 5+               , criterion >= 1.1.0.0+               , human-readable-duration++source-repository head+  type:     git+  location: https://gitlab.esy.fun/yogsototh/human-readable-duration
src/Data/Duration.hs view
@@ -51,9 +51,9 @@   | n < oneSecond = let mi = getMs      n in if mi > 0 then show mi ++ "ms" else ""   | n < minute = let s  = getSeconds n in if s  > 0 then show s  ++ "s " ++ humanReadableDuration (n `mod'` oneSecond) else ""   | n < hour   = let m  = getMinutes n in if m  > 0 then show m  ++ " min " ++ humanReadableDuration (n `mod'` minute) else ""-  | n < day    = let h  = getHours   n in if h  > 0 then show h  ++ " hours " ++ humanReadableDuration (n `mod'` hour) else ""-  | n < year   = let d  = getDays    n in if d  > 0 then show d  ++ " days " ++ humanReadableDuration (n `mod'` day) else ""-  | otherwise  = let y  = getYears   n in if y  > 0 then show y  ++ " years " ++ humanReadableDuration (n `mod'` year) else ""+  | n < day    = let h  = getHours   n in if h  > 0 then show h  ++ " hour" ++ (if h == 1 then " " else "s ") ++ humanReadableDuration (n `mod'` hour) else ""+  | n < year   = let d  = getDays    n in if d  > 0 then show d  ++ " day" ++ (if d == 1 then " " else "s ") ++ humanReadableDuration (n `mod'` day) else ""+  | otherwise  = let y  = getYears   n in if y  > 0 then show y  ++ " year" ++ (if y == 1 then " " else "s ") ++ humanReadableDuration (n `mod'` year) else ""   {- | `humanReadableDuration` take some time in micro-second precision and render a human readable duration.@@ -84,9 +84,9 @@   | n < oneSecond = let mi = getMs   n in show mi ++ "ms"   | n < minute = let s  = getSeconds n in show s  ++ "s"   | n < hour   = let m  = getMinutes n in show m  ++ " min"-  | n < day    = let h  = getHours   n in show h  ++ " hours"-  | n < year   = let d  = getDays    n in show d  ++ " days"-  | otherwise  = let y  = getYears   n in show y  ++ " years"+  | n < day    = let h  = getHours   n in show h  ++ " hour" ++ if h == 1 then "" else "s"+  | n < year   = let d  = getDays    n in show d  ++ " day" ++ if d == 1 then "" else "s"+  | otherwise  = let y  = getYears   n in show y  ++ " year" ++ if y == 1 then "" else "s"  -- | Wrapper around any `Real` input, which works for `DiffTime` and -- `NominalDiffTime` from the time library, or a `Double` of seconds.