# HG changeset patch # User Adam Chlipala # Date 1248039902 14400 # Node ID d1d0b18afd3d7c798a63d5b062368b74a9841c5a # Parent 2faf558b2d05638ccb7e47c7e4f4fe5e5ea53a47 Working on Grid; have gone from one dynamic table bizareness to another diff -r 2faf558b2d05 -r d1d0b18afd3d lib/js/urweb.js --- a/lib/js/urweb.js Sat Jul 18 15:08:21 2009 -0400 +++ b/lib/js/urweb.js Sun Jul 19 17:45:02 2009 -0400 @@ -223,12 +223,17 @@ return pos.parentNode; } +function parent() { + return thisScript ? thisScript.parentNode : lastParent(); +} + function addNode(node) { if (thisScript) { thisScript.parentNode.appendChild(node); thisScript.parentNode.removeChild(thisScript); - } else + } else { lastParent().appendChild(node); + } } function setHTML(html) { @@ -266,10 +271,8 @@ // Dynamic tree entry points -var dynDepth = 0; - function dyn(s) { - var x = document.createElement("span"); + var x = parent(); x.dead = false; x.signal = s; x.sources = null; @@ -298,7 +301,6 @@ x.closures = cls.v; runScripts(x); }; - addNode(x); populate(x); } diff -r 2faf558b2d05 -r d1d0b18afd3d lib/ur/monad.ur --- a/lib/ur/monad.ur Sat Jul 18 15:08:21 2009 -0400 +++ b/lib/ur/monad.ur Sun Jul 19 17:45:02 2009 -0400 @@ -5,3 +5,5 @@ others <- acc; return ({nm = this} ++ others)) (return {}) [ts] fd r + +fun ignore [m ::: Type -> Type] (_ : monad m) [t] (v : m t) = x <- v; return () diff -r 2faf558b2d05 -r d1d0b18afd3d lib/ur/monad.urs --- a/lib/ur/monad.urs Sat Jul 18 15:08:21 2009 -0400 +++ b/lib/ur/monad.urs Sun Jul 19 17:45:02 2009 -0400 @@ -1,2 +1,5 @@ val exec : m ::: (Type -> Type) -> monad m -> ts ::: {Type} -> $(map m ts) -> folder ts -> m $ts + +val ignore : m ::: (Type -> Type) -> monad m -> t ::: Type + -> m t -> m unit diff -r 2faf558b2d05 -r d1d0b18afd3d lib/ur/top.ur --- a/lib/ur/top.ur Sat Jul 18 15:08:21 2009 -0400 +++ b/lib/ur/top.ur Sun Jul 19 17:45:02 2009 -0400 @@ -51,7 +51,7 @@ fun not b = if b then False else True -con idT (t :: Type) = t +con id = K ==> fn t :: K => t con record (t :: {Type}) = $t con fst = K1 ==> K2 ==> fn t :: (K1 * K2) => t.1 con snd = K1 ==> K2 ==> fn t :: (K1 * K2) => t.2 @@ -92,11 +92,24 @@ fun txt [t] [ctx ::: {Unit}] [use ::: {Type}] (_ : show t) (v : t) = cdata (show v) +fun mp [K] [tf1 :: K -> Type] [tf2 :: K -> Type] (f : t ::: K -> tf1 t -> tf2 t) [r :: {K}] (fl : folder r) = + fl [fn r :: {K} => $(map tf1 r) -> $(map tf2 r)] + (fn [nm :: Name] [t :: K] [rest :: {K}] [[nm] ~ rest] acc r => + acc (r -- nm) ++ {nm = f r.nm}) + (fn _ => {}) + +fun map2 [K1] [K2] [tf1 :: K1 -> Type] [tf2 :: K2 -> Type] [tf :: K1 -> K2] + (f : t ::: K1 -> tf1 t -> tf2 (tf t)) [r :: {K1}] (fl : folder r) = + fl [fn r :: {K1} => $(map tf1 r) -> $(map tf2 (map tf r))] + (fn [nm :: Name] [t :: K1] [rest :: {K1}] [[nm] ~ rest] acc r => + acc (r -- nm) ++ {nm = f r.nm}) + (fn _ => {}) + fun foldUR [tf :: Type] [tr :: {Unit} -> Type] (f : nm :: Name -> rest :: {Unit} -> [[nm] ~ rest] => tf -> tr rest -> tr ([nm] ++ rest)) - (i : tr []) [r :: {Unit}] (fl : folder r)= + (i : tr []) [r :: {Unit}] (fl : folder r) = fl [fn r :: {Unit} => $(mapU tf r) -> tr r] (fn [nm :: Name] [t :: Unit] [rest :: {Unit}] [[nm] ~ rest] acc r => f [nm] [rest] ! r.nm (acc (r -- nm))) diff -r 2faf558b2d05 -r d1d0b18afd3d lib/ur/top.urs --- a/lib/ur/top.urs Sat Jul 18 15:08:21 2009 -0400 +++ b/lib/ur/top.urs Sun Jul 19 17:45:02 2009 -0400 @@ -21,7 +21,7 @@ val not : bool -> bool -con idT = fn t :: Type => t +con id = K ==> fn t :: K => t con record = fn t :: {Type} => $t con fst = K1 ==> K2 ==> fn t :: (K1 * K2) => t.1 con snd = K1 ==> K2 ==> fn t :: (K1 * K2) => t.2 @@ -45,6 +45,13 @@ val txt : t ::: Type -> ctx ::: {Unit} -> use ::: {Type} -> show t -> t -> xml ctx use [] +val mp : K --> tf1 :: (K -> Type) -> tf2 :: (K -> Type) + -> (t ::: K -> tf1 t -> tf2 t) + -> r :: {K} -> folder r -> $(map tf1 r) -> $(map tf2 r) +val map2 : K1 --> K2 --> tf1 :: (K1 -> Type) -> tf2 :: (K2 -> Type) -> tf :: (K1 -> K2) + -> (t ::: K1 -> tf1 t -> tf2 (tf t)) + -> r :: {K1} -> folder r -> $(map tf1 r) -> $(map tf2 (map tf r)) + val foldUR : tf :: Type -> tr :: ({Unit} -> Type) -> (nm :: Name -> rest :: {Unit} -> [[nm] ~ rest] => diff -r 2faf558b2d05 -r d1d0b18afd3d src/compiler.sig --- a/src/compiler.sig Sat Jul 18 15:08:21 2009 -0400 +++ b/src/compiler.sig Sun Jul 19 17:45:02 2009 -0400 @@ -120,6 +120,7 @@ val toSpecialize : (string, Core.file) transform val toShake3 : (string, Core.file) transform val toEspecialize : (string, Core.file) transform + val toReduce2 : (string, Core.file) transform val toShake4 : (string, Core.file) transform val toMarshalcheck : (string, Core.file) transform val toEffectize : (string, Core.file) transform diff -r 2faf558b2d05 -r d1d0b18afd3d src/compiler.sml --- a/src/compiler.sml Sat Jul 18 15:08:21 2009 -0400 +++ b/src/compiler.sml Sun Jul 19 17:45:02 2009 -0400 @@ -779,7 +779,9 @@ val toEspecialize = transform especialize "especialize" o toShake3 -val toShake4 = transform shake "shake4" o toEspecialize +val toReduce2 = transform reduce "reduce2" o toEspecialize + +val toShake4 = transform shake "shake4" o toReduce2 val marshalcheck = { func = (fn file => (MarshalCheck.check file; file)), diff -r 2faf558b2d05 -r d1d0b18afd3d src/elaborate.sml --- a/src/elaborate.sml Sat Jul 18 15:08:21 2009 -0400 +++ b/src/elaborate.sml Sun Jul 19 17:45:02 2009 -0400 @@ -1116,6 +1116,18 @@ fun elabHead (env, denv) infer (e as (_, loc)) t = let + fun unravelKind (t, e) = + case hnormCon env t of + (L'.TKFun (x, t'), _) => + let + val u = kunif loc + + val t'' = subKindInCon (0, u) t' + in + unravelKind (t'', (L'.EKApp (e, u), loc)) + end + | t => (e, t, []) + fun unravel (t, e) = case hnormCon env t of (L'.TKFun (x, t'), _) => @@ -1184,7 +1196,7 @@ | t => (e, t, []) in case infer of - L.DontInfer => (e, t, []) + L.DontInfer => unravelKind (t, e) | _ => unravel (t, e) end