verbosity
Simple enum that encodes application verbosity.
https://github.com/trskop/verbosity
| LTS Haskell 24.16: | 0.4.0.0 |
| Stackage Nightly 2025-10-24: | 0.4.0.0 |
| Latest on Hackage: | 0.4.0.0 |
BSD-3-Clause licensed by Peter Trško
Maintained by [email protected]
This version can be pinned in stack with:
verbosity-0.4.0.0@sha256:b396e2cb6880cf0b23794579f1903bace1c07db48d536ce3df0c80bc4569233d,4958Module documentation for 0.4.0.0
Depends on 6 packages(full list with versions):
verbosity
Description
Simple enum that encodes application verbosity with various useful instances.
Example
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingStrategies #-}
module Main.Options
( AppConfig(..)
, quietFlag
, incrementVerbosityFlag
)
where
import GHC.Generics (Generic)
import Data.Verbosity (Verbosity)
import qualified Data.Verbosity as Verbosity (Verbosity(Silent), increment')
import Data.Verbosity.Class (HasVerbosity, modifyVerbosity, setVerbosity)
import qualified Options.Applicative as Options
-- | Application configuration.
data AppConfig = AppConfig
{ verbosity :: Verbosity
-- , ...
}
deriving stock (Generic, Show)
deriving anyclass (HasVerbosity)
-- | Option for suppressing unnecessary output.
--
-- > -q, --quiet
-- > Quiet mode. Suppress normal diagnostic or result output.
quietFlag :: HasVerbosity a => Options.Parser (a -> a)
quietFlag = Options.flag id (setVerbosity Verbosity.Silent) $ mconcat
[ Options.long "quiet"
, Options.short 'q'
, Options.help "Quiet mode. Suppress normal diagnostic or result output."
]
-- | Flag for incrementing verbosity by one level. It can be used multiple
-- times to increase it more.
--
-- > -v
-- > Increment verbosity by one level. Can be used multiple times.
--
-- See 'Verbosity.increment'' for more details.
--
-- Note that this definition uses 'Options.flag'' under the hood to allow using
-- 'Control.Applicative.some' and 'Control.Applicative.many' combinators. In
-- other words, it will fail when used without these combinators or
-- 'Control.Applicative.optional'.
incrementVerbosityFlag :: HasVerbosity a => Options.Parser (a -> a)
incrementVerbosityFlag =
Options.flag' (modifyVerbosity Verbosity.increment') $ mconcat
[ Options.short 'v'
, Options.help "Increment verbosity by one level. Can be used multiple times."
]
Changes
ChangeLog / ReleaseNotes
Version 0.4.0.0
-
Bumped lower bound of
dhalllibrary set to 1.23.0. Version 1.22.0 supported Dhall Standard 7.0.0, however, it failed to deserialise new-style enums properly, which was fixed in version 1.23.0. (breaking change) -
Dhall library restructured to fit with current Dhall best practices.
-
Bumped upper bound of
latticesto support versions 2.* (breaking change) -
Bumped upper bound of
generic-lensto support versions 2.* (change) -
Bumped upper bound of
safecopyto support versions 0.10.* (change) -
Removed
data-defaultdependency and associated instance forDefaulttype class. (breaking change)
Version 0.3.0.0
- Optional instances for
JoinSemiLattice,MeetSemiLattice,BoundedJoinSemiLattice,BoundedMeetSemiLattice,Lattice, andBoundedLattice. Dependency onlatticespackage can be enabled using-flatticesbuild flag. (new) - Optional instances for
Dhall.InterpretDhall.Injecttype classes. Dependency ondhallpackage can be enabled using-fdhallbuild flag. Enabled by default. (new) - Optional instances for
Serialisetype class fromserialisepackage that provides CBOR serialisation/deserialisation. Dependency onserialisepackage can be enabled using-fserialisebuild flag. Enabled by default. (new) HasVerbositytype class now provides default implementation forverbositylens that usesgeneric-lens. (change/new)- Dropped support for GHC < 8.2. As a consequence
Data,Generic, andTypeableare always derived. The last one is implied by the fact that GHC now always derives it. (breaking change) - Uploaded to Hackage: http://hackage.haskell.org/package/verbosity-0.3.0.0
Version 0.2.3.0
- Introducing function
modifyVerbosity :: HasVerbosity s => (Verbosity -> Verbosity) -> s -> s(new) - Introducing optional instance for safecopy’s
SafeCopytype class. Dependency onsafecopypackage can be enabled using-fsafecopybuild flag. (new) - Uploaded to Hackage: http://hackage.haskell.org/package/verbosity-0.2.3.0
Version 0.2.2.0
- Relaxed
data-default-classdependency that allows bilding with version 0.1.*. (change) - Introducing functions (new):
increment :: Verbosity -> Maybe Verbosityincrement' :: Verbosity -> Verbosity
- Uploaded to Hackage: http://hackage.haskell.org/package/verbosity-0.2.2.0
Version 0.2.1.0
- Introducing optional instance for cereal’s
Serializetype class. Dependency oncerealpackage can be enabled using-fcerealbuild flag. (new) - Uploaded to Hackage: http://hackage.haskell.org/package/verbosity-0.2.1.0
Version 0.2.0.0
- Introducing module
Data.Verbosity.Classwhich contains definition ofHasVerbositytype class. (new) - Introducing function
fromInt :: Int -> Maybe Verbosity. (new) - Introducing function
parse :: (Eq string, IsString string) => string -> Maybe Verbosity. (new) - NFData instance, if compiled with
-fdeepseq, which is the default case. (new) - Depends on transformers package in case base <4.8. (new)
- Uploaded to Hackage: http://hackage.haskell.org/package/verbosity-0.2.0.0
Version 0.1.0.0
- First public release.
- Uploaded to Hackage: http://hackage.haskell.org/package/verbosity-0.1.0.0