never executed always true always false
1 module HelVM.HelMA.Automaton.Types.DumpType where
2
3 import HelVM.HelMA.Automaton.IO.BusinessIO
4
5 import HelVM.HelIO.Control.Logger
6
7 import HelVM.HelIO.Extra
8
9 logDump :: (BIO m , Show d) => DumpType -> d -> m ()
10 logDump dt d = logDump' $ dump dt d where
11 logDump' Nothing = pass
12 logDump' (Just t) = logMessageTuple ("dump" , t)
13
14 dump :: Show a => DumpType -> a -> Maybe Text
15 dump No _ = Nothing
16 dump Ugly a = Just $ show a
17 dump Pretty a = Just $ showP a
18
19 -- | Constructors
20 defaultDumpType :: DumpType
21 defaultDumpType = minBound
22
23 dumpTypes :: NonEmpty DumpType
24 dumpTypes = universeNonEmpty
25
26 -- | Types
27 data DumpType = No | Ugly | Pretty
28 deriving stock (Bounded , Enum , Eq , Read , Show)