never executed always true always false
1 module HelVM.HelMA.Automaton.API.OptimizationLevel where
2
3 import HelVM.HelIO.SwitchEnum
4
5 import HelVM.HelIO.Containers.LLIndexSafe
6
7 -- | Constructors
8
9 --TODO to remove
10 fromBool :: Bool -> OptimizationLevel
11 fromBool = enumFromBool
12
13 fromNatural :: Natural -> OptimizationLevel
14 fromNatural = fromMaybe AllOptimizations . indexMaybe (toList optimizationLevels) . fromIntegral
15
16 defaultOptimizationLevel :: OptimizationLevel
17 defaultOptimizationLevel = minBound
18
19 optimizationLevels :: NonEmpty OptimizationLevel
20 optimizationLevels = universeNonEmpty
21
22 -- | Types
23
24 data OptimizationLevel =
25 NoOptimizations
26 | BasicOptimizations
27 | SomeOptimizations
28 | AllOptimizations
29 deriving stock (Bounded , Enum , Eq , Read , Show)