module ConstMath.Types (
Opts(..)
, Verbosity(..)
, CmInsertion(..)
, defaultOpts
, setVerbosity
, setDry
, setInsertion
, quiet
, verbose
, traced
, dry
) where
data Verbosity = None | CmVerbose Int | Trace deriving (Eq, Show, Ord)
data CmInsertion =
CmPostSimplifyEarly
| CmPostSimplify
| CmAlways
deriving (Eq, Show, Ord)
data Opts = Opts
{ cmVerbosity :: Verbosity
, dryRun :: Bool
, cmInsertion :: CmInsertion
}
deriving (Eq, Show)
setVerbosity :: Verbosity -> Opts -> Opts
setVerbosity cmVerbosity opts = opts{cmVerbosity}
setDry :: Opts -> Opts
setDry opts = opts{dryRun=True}
setInsertion :: CmInsertion -> Opts -> Opts
setInsertion cmInsertion opts = opts{cmInsertion}
defaultOpts :: Opts
defaultOpts = Opts None False CmPostSimplifyEarly
quiet :: Opts -> Bool
quiet Opts{cmVerbosity} = cmVerbosity == None
verbose :: Opts -> Bool
verbose Opts{cmVerbosity} = cmVerbosity > CmVerbose 0
traced :: Opts -> Bool
traced Opts{cmVerbosity} = cmVerbosity >= Trace
dry :: Opts -> Bool
dry Opts{dryRun} = dryRun