-
Notifications
You must be signed in to change notification settings - Fork 0
/
semester.ur
43 lines (35 loc) · 1.44 KB
/
semester.ur
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
(* Data associated with a semester at MIT *)
signature INPUT = sig
val regDay : time
val classesDone : time
val notable : list (time * string)
end
signature OUTPUT = sig
val regDay : time
val classesDone : time
con private :: (Type * Type * Type)
val cal : Calendar.t [Notable = string] [Notable = private]
end
functor Make(M : INPUT) = struct
open M
table notables : { Notable : string, When : time }
PRIMARY KEY When
task initialize = fn () =>
dml (DELETE FROM notables WHERE TRUE);
List.app (fn (tm, s) => dml (INSERT INTO notables(Notable, When)
VALUES ({[s]}, {[tm]}))) notable
open Calendar.FromTable(struct
con tag = #Notable
con key = [Notable = (string, _, _)]
con times = [When]
val tab = notables
val labels = {Notable = "Event",
When = "Day"}
val title = "Academic Calendar"
val display = None
val auth = return Calendar.Read
val kinds = {When = ""}
val sh = mkShow (fn {Notable = s} => s)
val showTime = False
end)
end