summaryrefslogtreecommitdiff
path: root/forum/asker.ur
diff options
context:
space:
mode:
authorGravatar Benjamin Barenblat <bbaren@mit.edu>2013-04-25 17:03:10 -0400
committerGravatar Benjamin Barenblat <bbaren@mit.edu>2013-04-25 17:03:10 -0400
commit350cde2324cf4bc9df6c4bcecf638b8208495b64 (patch)
tree27e37ffd6d8533aae86ba3f38d12fc0a1cfd6fa8 /forum/asker.ur
parent3c4174548b561c4813ad1f4df4d59104a81885d3 (diff)
Forum: Move asker into its own datatype
Diffstat (limited to 'forum/asker.ur')
-rw-r--r--forum/asker.ur26
1 files changed, 26 insertions, 0 deletions
diff --git a/forum/asker.ur b/forum/asker.ur
new file mode 100644
index 0000000..947f20c
--- /dev/null
+++ b/forum/asker.ur
@@ -0,0 +1,26 @@
+type asker = option string
+
+val eq_asker = Option.eq
+
+val show_asker =
+ mkShow (
+ fn nameOpt =>
+ case nameOpt of
+ None => "Anonymous"
+ | Some nam => nam
+ )
+
+val read_asker =
+ let fun parse text =
+ case text of
+ "Anonymous" => None
+ | nam => Some nam
+ in
+ mkRead parse (compose Some parse)
+ end
+
+val sql_asker = sql_option_prim
+
+val anonymous = None
+
+val namedAsker = Some