summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorJoey Hess2016-03-08 06:14:20 -0400
committerJoey Hess2016-03-08 06:14:20 -0400
commit798a86d098c725c21fafde203961ba0e2433f09c (patch)
treecf2d3a3bb397da1cb6f27bb45c3443ff03240a97 /doc
parent580ee07b75d8c1e56d1d96e827339db5c84e4004 (diff)
parentb13f95a2505e96768d22df1219aba414f26f6882 (diff)
Merge branch 'joeyconfig'
Diffstat (limited to 'doc')
-rw-r--r--doc/todo/type_level_privdata_availability_checking.mdwn34
1 files changed, 34 insertions, 0 deletions
diff --git a/doc/todo/type_level_privdata_availability_checking.mdwn b/doc/todo/type_level_privdata_availability_checking.mdwn
new file mode 100644
index 00000000..7f02c700
--- /dev/null
+++ b/doc/todo/type_level_privdata_availability_checking.mdwn
@@ -0,0 +1,34 @@
+When a property needs privdata to be set, it will fail at runtime when
+it's not available. Could this be detected at compile time instead?
+
+Here's an idea of a way to do it. Make propellor, whenever it adds/removes
+privdata, generate a haskell source file, Propellor/PrivData/Available.hs
+
+It would have one type-level function
+
+ data Available
+ type family HasPrivData source context
+ type instance HasPrivData "password" "foo.com" = Available
+ -- ^ supposed to be type level strings
+
+The file would generate instances of the type family or each available privdata
+value.
+
+`withPrivData` would use this type level function, and require it to return
+Availble. If it didn't, the type checker would blow up.
+
+(Controlling the type error message content to make it clear what went wrong
+may be tricky.)
+
+For this to work, `withPrivData` would need some interesting changes to its
+type signature, so that it has available the type level strings describing
+the privdata it's supposed to get. Is that practical? I think so,
+actually..
+
+ withPrivData :: (HasPrivData source context) => source -> context -> (((PrivData -> Propellor Result) -> Propellor Result) -> Property i) -> Property HasInfo
+
+All that's needed is a way to provide a type level string from which a
+string value can be extracted that has the same string as the type. IIRC,
+that's supported by type level strings.
+
+--[[Joey]]