annotate sourceL.ur @ 26:86857ae0f386

Change more dashes to slashes, for JavaScript compatibility
author Adam Chlipala <adam@chlipala.net>
date Fri, 09 Dec 2011 17:38:20 -0500
parents 8300d5f0dc19
children
rev   line source
adam@15 1 con t a = {Source : source a,
adam@15 2 OnSet : source (a -> transaction {})}
kkallio@14 3
adam@15 4 fun create [a] (i : a) =
adam@15 5 s <- source i;
adam@15 6 f <- source (fn _ => return ());
kkallio@14 7
adam@15 8 return {Source = s,
adam@15 9 OnSet = f}
kkallio@14 10
adam@15 11 fun onChange [a] (t : t a) f =
adam@15 12 old <- get t.OnSet;
adam@15 13 set t.OnSet (fn x => (old x; f x))
kkallio@14 14
adam@15 15 fun set [a] (t : t a) (v : a) =
adam@15 16 Basis.set t.Source v;
adam@15 17 f <- get t.OnSet;
adam@15 18 f v
kkallio@14 19
adam@15 20 fun get [a] (t : t a) = Basis.get t.Source
kkallio@14 21
adam@15 22 fun value [a] (t : t a) = signal t.Source