verbosity-0.2.2.0: Simple enum that encodes application verbosity.

Copyright(c) 2015-2016 Peter Trško
LicenseBSD3
Maintainerpeter.trsko@gmail.com
Stabilityexperimental
PortabilityBangPatterns (optional), CPP, NoImplicitPrelude, DeriveDataTypeable (optional), DeriveGeneric (optional)
Safe HaskellSafe
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 # 
Enum Verbosity Source # 
Eq Verbosity Source # 
Data Verbosity Source # 

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 # 
Read Verbosity Source # 
Show Verbosity Source # 
Generic Verbosity Source # 

Associated Types

type Rep Verbosity :: * -> * #

Binary Verbosity Source #

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

Default Verbosity Source #
def = Normal

Methods

def :: Verbosity #

NFData Verbosity Source # 

Methods

rnf :: Verbosity -> () #

HasVerbosity Verbosity Source # 
type Rep Verbosity Source # 
type Rep Verbosity = D1 (MetaData "Verbosity" "Data.Verbosity" "verbosity-0.2.2.0-LNNHPoBwZHh5ZwYi5ZI4su" False) ((:+:) ((:+:) (C1 (MetaCons "Silent" PrefixI False) U1) (C1 (MetaCons "Normal" PrefixI False) U1)) ((:+:) (C1 (MetaCons "Verbose" PrefixI False) U1) (C1 (MetaCons "Annoying" PrefixI False) U1)))

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