|
3 | 3 | module GF.Compile.Compute.Concrete2 |
4 | 4 | (Env, Scope, Value(..), Variants(..), Constraint, OptionInfo(..), ChoiceMap, cleanOptions, |
5 | 5 | ConstValue(..), ConstVariants(..), Globals(..), PredefTable, EvalM, |
6 | | - mapVariants, unvariants, variants2consts, consts2variants, |
| 6 | + mapVariants, mapVariantsC, unvariants, variants2consts, |
| 7 | + mapConstVs, mapConstVsC, unconstVs, consts2variants, |
7 | 8 | runEvalM, runEvalMWithOpts, stdPredef, globals, |
8 | 9 | PredefImpl, Predef(..), ($\), |
9 | 10 | pdCanonicalArgs, pdArity, |
@@ -102,6 +103,10 @@ mapVariants :: (Value -> Value) -> Variants -> Variants |
102 | 103 | mapVariants f (VarFree vs) = VarFree (f <$> vs) |
103 | 104 | mapVariants f (VarOpts n cs) = VarOpts n (second f <$> cs) |
104 | 105 |
|
| 106 | +mapVariantsC :: (Choice -> Value -> Value) -> Choice -> Variants -> Variants |
| 107 | +mapVariantsC f c (VarFree vs) = VarFree (mapC f c vs) |
| 108 | +mapVariantsC f c (VarOpts n cs) = VarOpts n (mapC (second . f) c cs) |
| 109 | + |
105 | 110 | unvariants :: Variants -> [Value] |
106 | 111 | unvariants (VarFree vs) = vs |
107 | 112 | unvariants (VarOpts n cs) = snd <$> cs |
@@ -142,6 +147,10 @@ mapConstVs :: (ConstValue a -> ConstValue b) -> ConstVariants a -> ConstVariants |
142 | 147 | mapConstVs f (ConstFree vs) = ConstFree (f <$> vs) |
143 | 148 | mapConstVs f (ConstOpts n cs) = ConstOpts n (second f <$> cs) |
144 | 149 |
|
| 150 | +mapConstVsC :: (Choice -> ConstValue a -> ConstValue b) -> Choice -> ConstVariants a -> ConstVariants b |
| 151 | +mapConstVsC f c (ConstFree vs) = ConstFree (mapC f c vs) |
| 152 | +mapConstVsC f c (ConstOpts n cs) = ConstOpts n (mapC (second . f) c cs) |
| 153 | + |
145 | 154 | unconstVs :: ConstVariants a -> [ConstValue a] |
146 | 155 | unconstVs (ConstFree vs) = vs |
147 | 156 | unconstVs (ConstOpts n cs) = snd <$> cs |
|
0 commit comments