summaryrefslogtreecommitdiff
path: root/src/compiler/GF/Compile/Compute/Predef.hs
diff options
context:
space:
mode:
authorhallgren <hallgren@chalmers.se>2012-12-11 15:37:41 +0000
committerhallgren <hallgren@chalmers.se>2012-12-11 15:37:41 +0000
commit5e091d2e3dc428daa1d4b0d8df6e7b613adc22a9 (patch)
tree5c2c62eabdeab22d443cca85b9d7b48aec436c19 /src/compiler/GF/Compile/Compute/Predef.hs
parent2623925e67b240f289b7ca507dd9c1ae194a93ce (diff)
partial evaluator work
* Evaluate operators once, not every time they are looked up * Remember the list of parameter values instead of recomputing it from the pattern type every time a table selection is made. * Quick fix for partial application of some predefined functions.
Diffstat (limited to 'src/compiler/GF/Compile/Compute/Predef.hs')
-rw-r--r--src/compiler/GF/Compile/Compute/Predef.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/compiler/GF/Compile/Compute/Predef.hs b/src/compiler/GF/Compile/Compute/Predef.hs
index 1647b2a92..e6fd6af7c 100644
--- a/src/compiler/GF/Compile/Compute/Predef.hs
+++ b/src/compiler/GF/Compile/Compute/Predef.hs
@@ -9,8 +9,9 @@ import Data.Char (isUpper,toLower,toUpper)
import GF.Data.Utilities (mapSnd,apBoth)
import GF.Compile.Compute.Value
-import GF.Infra.Ident (Ident)
+import GF.Infra.Ident (Ident,varX)
import GF.Grammar.Predef
+import PGF.Data(BindType(..))
predefs :: Map.Map Ident ([Value]->Value)
predefs = Map.fromList $ mapSnd strictf
@@ -40,6 +41,10 @@ predefs = Map.fromList $ mapSnd strictf
apISS f vs = case vs of
[VInt i, VString s] -> string (f i s)
+ [VInt i] -> VAbs Explicit (varX 0) $ Bind $ \ v ->
+ case norm v of
+ VString s -> string (f i s)
+ _ -> bug $ "f::Int->Str->Str got "++show (vs++[v])
_ -> bug $ "f::Int->Str->Str got "++show vs
apSSB f vs = case vs of