Mercurial > gui
comparison sourceL.ur @ 15:8300d5f0dc19
Replace ChangePoller with SourceL, plus some other rearrangements
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Sun, 07 Aug 2011 14:38:52 -0400 |
parents | changePoller.ur@0827320b0f04 |
children |
comparison
equal
deleted
inserted
replaced
14:0827320b0f04 | 15:8300d5f0dc19 |
---|---|
1 con t a = {Source : source a, | |
2 OnSet : source (a -> transaction {})} | |
3 | |
4 fun create [a] (i : a) = | |
5 s <- source i; | |
6 f <- source (fn _ => return ()); | |
7 | |
8 return {Source = s, | |
9 OnSet = f} | |
10 | |
11 fun onChange [a] (t : t a) f = | |
12 old <- get t.OnSet; | |
13 set t.OnSet (fn x => (old x; f x)) | |
14 | |
15 fun set [a] (t : t a) (v : a) = | |
16 Basis.set t.Source v; | |
17 f <- get t.OnSet; | |
18 f v | |
19 | |
20 fun get [a] (t : t a) = Basis.get t.Source | |
21 | |
22 fun value [a] (t : t a) = signal t.Source |