From a59967d5f96726ab76f75c7cb7f56c6beccfd16f Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Thu, 5 Jun 2025 11:57:31 +0000 Subject: [PATCH] added value2float, exported value2float, value2int --- src/compiler/api/GF/Compile/Compute/Concrete2.hs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/compiler/api/GF/Compile/Compute/Concrete2.hs b/src/compiler/api/GF/Compile/Compute/Concrete2.hs index 9c6d9cf56..29ecfbecf 100644 --- a/src/compiler/api/GF/Compile/Compute/Concrete2.hs +++ b/src/compiler/api/GF/Compile/Compute/Concrete2.hs @@ -8,7 +8,7 @@ module GF.Compile.Compute.Concrete2 PredefImpl, Predef(..), ($\), pdCanonicalArgs, pdArity, normalForm, normalFlatForm, - eval, apply, value2term, value2termM, bubble, patternMatch, vtableSelect, State(..), + eval, apply, value2term, value2termM, value2int, value2float, bubble, patternMatch, vtableSelect, State(..), newResiduation, getMeta, setMeta, MetaState(..), variants, try, evalError, evalWarn, ppValue, Choice(..), unit, poison, split, split3, split4, mapC, mapCM) where @@ -1101,6 +1101,12 @@ value2int g (VInt n) = Const n value2int g (VFV s vs) = CFV s (variants2consts (value2int g) vs) value2int g _ = RunTime +value2float g (VMeta i vs) = CSusp i (\v -> value2float g (apply g v vs)) +value2float g (VSusp i k vs) = CSusp i (\v -> value2float g (apply g (k v) vs)) +value2float g (VFlt f) = Const f +value2float g (VFV s vs) = CFV s (variants2consts (value2float g) vs) +value2float g _ = RunTime + newtype Choice = Choice { unchoice :: Integer } deriving (Eq,Ord,Pretty,Show)