verbosity 0.2.1.0 → 0.2.2.0
raw patch · 3 files changed
+34/−7 lines, 3 files
Files
- ChangeLog.md +9/−0
- src/Data/Verbosity.hs +21/−3
- verbosity.cabal +4/−4
ChangeLog.md view
@@ -1,10 +1,19 @@ # ChangeLog / ReleaseNotes +## Version 0.2.2.0++* Relaxed `data-default-class` dependency that allows bilding with version+ 0.1.\*.+* Introducing functions:+ * `increment :: Verbosity -> Maybe Verbosity`+ * `increment' :: Verbosity -> Verbosity`+ ## Version 0.2.1.0 * Introducing optional instance for cereal's `Serialize` type class. Dependency on `cereal` package can be enabled using `-fcereal` build flag. (new)+* Uploaded to [Hackage][]: <http://hackage.haskell.org/package/verbosity-0.2.1.0> ## Version 0.2.0.0
src/Data/Verbosity.hs view
@@ -16,7 +16,7 @@ -- | -- Module: $HEADER$ -- Description: Verbosity enum.--- Copyright: (c) 2015, Peter Trško+-- Copyright: (c) 2015-2016 Peter Trško -- License: BSD3 -- -- Maintainer: peter.trsko@gmail.com@@ -27,6 +27,8 @@ -- Simple enum that encodes application 'Verbosity'. module Data.Verbosity ( Verbosity(..)+ , increment+ , increment' , fromInt #ifdef DERIVE_DATA_TYPEABLE , parse@@ -36,7 +38,7 @@ import Prelude ( Bounded(maxBound, minBound)- , Enum(fromEnum, toEnum)+ , Enum(fromEnum, succ, toEnum) #ifdef DECLARE_BINARY_INSTANCE , fromIntegral #endif@@ -45,7 +47,7 @@ import Data.Bool ((&&), otherwise) import Data.Eq (Eq) import Data.Int (Int)-import Data.Maybe (Maybe(..))+import Data.Maybe (Maybe(..), fromMaybe) import Data.Ord (Ord(..)) import Text.Read (Read) import Text.Show (Show)@@ -143,6 +145,22 @@ instance NFData Verbosity where rnf !_ = () #endif++-- | Increment verbosity level. Return 'Nothing' if trying to icrement beyond+-- 'maxBound'.+increment :: Verbosity -> Maybe Verbosity+increment v+ | v < maxBound = Just (succ v)+ | otherwise = Nothing++-- | Variant of 'increment' that doesn't fail when 'maxBound' is reached. It+-- is defined as:+--+-- @+-- 'increment'' v = 'fromMaybe' v ('increment' v)+-- @+increment' :: Verbosity -> Verbosity+increment' v = fromMaybe v (increment v) -- | Safe version of 'toEnum' specialized to 'Verbosity'. fromInt :: Int -> Maybe Verbosity
verbosity.cabal view
@@ -1,5 +1,5 @@ name: verbosity-version: 0.2.1.0+version: 0.2.2.0 synopsis: Simple enum that encodes application verbosity. description: Simple enum that encodes application verbosity with various useful instances.@@ -10,7 +10,7 @@ license-file: LICENSE author: Peter Trško maintainer: peter.trsko@gmail.com-copyright: (c) 2015, Peter Trško+copyright: (c) 2015-2016 Peter Trško category: Data build-type: Simple cabal-version: >=1.10@@ -99,7 +99,7 @@ cpp-options: -DDECLARE_BINARY_INSTANCE if flag(data-default)- build-depends: data-default-class ==0.0.*+ build-depends: data-default-class ==0.0.* || ==0.1.* cpp-options: -DDECLARE_DEFAULT_INSTANCE if flag(deepseq)@@ -118,4 +118,4 @@ source-repository this type: git location: git://github.com/trskop/verbosity.git- tag: v0.2.1.0+ tag: 0.2.2.0