# HG changeset patch # User Ziv Scully # Date 1443389097 14400 # Node ID 6951a645ccdffd1ecc4441d6264856b2223a7ed8 # Parent b1ba35ce2613b81830401ce3db850c4523f3f2f0 Fix effectfulness registration toy cache. diff -r b1ba35ce2613 -r 6951a645ccdf src/sqlcache.sml --- a/src/sqlcache.sml Sun Sep 27 17:02:14 2015 -0400 +++ b/src/sqlcache.sml Sun Sep 27 17:24:57 2015 -0400 @@ -41,6 +41,8 @@ "urlifyBool_w", "urlifyChannel_w"] in + (* ASK: nicer way than using [Settings.addEffectful] for each Sqlcache + function? Right now they're all always effectful. *) fn (m, f) => Settings.isEffectful (m, f) andalso not (m = "Basis" andalso SS.member (okayWrites, f)) end @@ -807,12 +809,15 @@ fn Pure f => f () | Impure e => e +(* TODO: pick a number. *) +val sizeWorthCaching = 5 + fun makeCache (env, exp', index) = case typOfExp' env exp' of NONE => NONE | SOME (TFun _, _) => NONE | SOME typ => - if expSize (exp', dummyLoc) < 5 (* TODO: pick a number. *) + if expSize (exp', dummyLoc) < sizeWorthCaching then NONE else case List.foldr (fn ((_, _), NONE) => NONE | ((n, typ), SOME args) => diff -r b1ba35ce2613 -r 6951a645ccdf src/toy_cache.sml --- a/src/toy_cache.sml Sun Sep 27 17:02:14 2015 -0400 +++ b/src/toy_cache.sml Sun Sep 27 17:24:57 2015 -0400 @@ -13,7 +13,13 @@ fun withTyp typ = map (fn exp => (exp, typ)) fun ffiAppCache' (func, index, argTyps) = - EFfiApp ("Sqlcache", func ^ Int.toString index, argTyps) + let + val m = "Sqlcache" + val f = func ^ Int.toString index + in + Settings.addEffectful (m, f); + EFfiApp (m, f, argTyps) + end fun check (index, keys) = ffiAppCache' ("check", index, withTyp stringTyp keys)