aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/world/service/journal.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/library/lux/world/service/journal.lux')
-rw-r--r--stdlib/source/library/lux/world/service/journal.lux51
1 files changed, 51 insertions, 0 deletions
diff --git a/stdlib/source/library/lux/world/service/journal.lux b/stdlib/source/library/lux/world/service/journal.lux
new file mode 100644
index 000000000..ba42af209
--- /dev/null
+++ b/stdlib/source/library/lux/world/service/journal.lux
@@ -0,0 +1,51 @@
+(.module:
+ [library
+ [lux #*
+ [control
+ [equivalence (#+ Equivalence)]
+ [interval (#+ Interval)]
+ [try (#+ Try)]
+ [security
+ ["!" capability (#+ capability:)]]]
+ [data
+ ["." text ("#\." equivalence)]]
+ [time
+ ["." instant (#+ Instant) ("#\." equivalence)]]]])
+
+(type: #export (Entry a)
+ {#what a
+ #why Text
+ #how Text
+ #who Text
+ #where Text
+ #when Instant})
+
+(type: #export Range
+ (Interval Instant))
+
+(def: #export (range start end)
+ (-> Instant Instant Range)
+ (implementation
+ (def: &enum instant.enum)
+ (def: bottom start)
+ (def: top end)))
+
+(implementation: #export (equivalence (^open "_\."))
+ (All [a] (-> (Equivalence a) (Equivalence (Entry a))))
+ (def: (= reference sample)
+ (and (_\= (get@ #what reference) (get@ #what sample))
+ (text\= (get@ #why reference) (get@ #why sample))
+ (text\= (get@ #how reference) (get@ #how sample))
+ (text\= (get@ #who reference) (get@ #who sample))
+ (text\= (get@ #where reference) (get@ #where sample))
+ (instant\= (get@ #when reference) (get@ #when sample)))))
+
+(capability: #export (Can-Write ! a)
+ (can-write (Entry a) (! (Try Any))))
+
+(capability: #export (Can-Read ! a)
+ (can-read Range (! (Try (List (Entry a))))))
+
+(type: #export (Journal ! a)
+ {#can-write (Can-Write ! a)
+ #can-read (Can-Read ! a)})