verbosity-0.3.0.0: Simple enum that encodes application verbosity.

Copyright(c) 2015-2019 Peter Trško
LicenseBSD3
Maintainerpeter.trsko@gmail.com
Stabilityexperimental
PortabilityGHC specific language extensions.
Safe HaskellNone
LanguageHaskell2010

Data.Verbosity

Description

Simple enum that encodes application Verbosity.

Synopsis

Documentation

data Verbosity Source #

Ordering:

Silent < Normal < Verbose < Annoying

Bounds:

minBound = Silent; maxBound = Annoying

Enum:

map fromEnum [Silent .. Annoying] = [0, 1, 2, 3]

Constructors

Silent

Don't print any messages.

Normal

Print only important messages. (default)

Verbose

Print anything that comes in to mind.

Annoying

Print debugging/tracing information.

Instances
Bounded Verbosity Source # 
Instance details

Defined in Data.Verbosity

Enum Verbosity Source # 
Instance details

Defined in Data.Verbosity

Eq Verbosity Source # 
Instance details

Defined in Data.Verbosity

Data Verbosity Source # 
Instance details

Defined in Data.Verbosity

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Verbosity -> c Verbosity #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Verbosity #

toConstr :: Verbosity -> Constr #

dataTypeOf :: Verbosity -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Verbosity) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Verbosity) #

gmapT :: (forall b. Data b => b -> b) -> Verbosity -> Verbosity #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Verbosity -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Verbosity -> r #

gmapQ :: (forall d. Data d => d -> u) -> Verbosity -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Verbosity -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Verbosity -> m Verbosity #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Verbosity -> m Verbosity #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Verbosity -> m Verbosity #

Ord Verbosity Source # 
Instance details

Defined in Data.Verbosity

Read Verbosity Source # 
Instance details

Defined in Data.Verbosity

Show Verbosity Source # 
Instance details

Defined in Data.Verbosity

Generic Verbosity Source # 
Instance details

Defined in Data.Verbosity

Associated Types

type Rep Verbosity :: Type -> Type #

Binary Verbosity Source #

Encoded as one byte in range [minBound .. maxBound :: Verbosity].

Instance details

Defined in Data.Verbosity

NFData Verbosity Source # 
Instance details

Defined in Data.Verbosity

Methods

rnf :: Verbosity -> () #

Default Verbosity Source #
def = Normal
Instance details

Defined in Data.Verbosity

Methods

def :: Verbosity #

Interpret Verbosity Source # 
Instance details

Defined in Data.Verbosity

Inject Verbosity Source # 
Instance details

Defined in Data.Verbosity

Serialise Verbosity Source # 
Instance details

Defined in Data.Verbosity

HasVerbosity Verbosity Source # 
Instance details

Defined in Data.Verbosity.Class

type Rep Verbosity Source # 
Instance details

Defined in Data.Verbosity

type Rep Verbosity = D1 (MetaData "Verbosity" "Data.Verbosity" "verbosity-0.3.0.0-B0fuaQhJZOz1QpHCdys5er" False) ((C1 (MetaCons "Silent" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "Normal" PrefixI False) (U1 :: Type -> Type)) :+: (C1 (MetaCons "Verbose" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "Annoying" PrefixI False) (U1 :: Type -> Type)))

increment :: Verbosity -> Maybe Verbosity Source #

Increment verbosity level. Return Nothing if trying to icrement beyond maxBound.

increment' :: Verbosity -> Verbosity Source #

Variant of increment that doesn't fail when maxBound is reached. It is defined as:

increment' v = fromMaybe v (increment v)

fromInt :: Int -> Maybe Verbosity Source #

Safe version of toEnum specialized to Verbosity.

parse :: (Eq string, IsString string) => string -> Maybe Verbosity Source #

Generic Verbosity parsing function.

Use case-insensitive package to make this function case insensitive:

ghci> import Data.Verbosity as Verbosity
ghci> import qualified Data.CaseInsensitive as CI (mk)
ghci> Verbosity.parse (CI.mk "silent")
Just Silent