summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorJoey Hess2015-10-27 14:34:10 -0400
committerJoey Hess2015-10-27 14:37:02 -0400
commit56c3394144abbb9862dc67379d3253c76ae4df97 (patch)
tree7e643b1f938343f883f6379382440516e6d3a5db /doc
parent77e3a5d4d968f3567b1b8e62996e0e6c803ab642 (diff)
Explicit Info/NoInfo for RevertableProperty (API change)
RevertableProperty used to be assumed to contain info, but this is now made explicit, with RevertableProperty HasInfo or RevertableProperty NoInfo. Transition guide: - If you define a RevertableProperty, expect some type check failures like: "Expecting one more argument to ‘RevertableProperty’". - Change it to "RevertableProperty NoInfo" - The compiler will then tell you if it needs "HasInfo" instead. - If you have code that uses the RevertableProperty constructor that fails to type check, use the more powerful <!> operator
Diffstat (limited to 'doc')
-rw-r--r--doc/todo/RevertableProperty_with_NoInfo.mdwn30
1 files changed, 30 insertions, 0 deletions
diff --git a/doc/todo/RevertableProperty_with_NoInfo.mdwn b/doc/todo/RevertableProperty_with_NoInfo.mdwn
index 3b4a61a9..1aea0a04 100644
--- a/doc/todo/RevertableProperty_with_NoInfo.mdwn
+++ b/doc/todo/RevertableProperty_with_NoInfo.mdwn
@@ -16,3 +16,33 @@ a mouthful!
Since only 2 places in the propellor source code currently need to deal
with this, it doesn't currently seem worth making the change, unless a less
intrusive way can be found.
+
+> Hmm.. I'm not sure what I meant by that last paragraph, but I'm sure
+> this wart is annoying in more than 2 places by now. --[[Joey]]
+
+> Would be nice to instead have `RevertableProperty i`, where the i was inherited
+> from the currently active property. This would be less of a mouthful,
+> and models the info transfer correctly. Ie, if I have a
+> RevertableProperty that includes dns settings on its setup side,
+> reverting it means dropping those dns settings, so the result is NoInfo.
+
+> Unfortunately, when I tried to implement this, the types prevented it.
+> In particular, anything to do with the second property in a
+> `RevertableProperty i` is a problem because we don't know what
+> type of Property it is. For example:
+
+ data RevertableProperty i where
+ RIProperty :: Property HasInfo -> Property i -> RevertableProperty HasInfo
+ RSProperty :: Property NoInfo -> Property i -> RevertableProperty NoInfo
+
+ activeProperty :: RevertableProperty i -> Property i
+ activeProperty (RIProperty p _) = p
+ activeProperty (RSProperty p _) = p
+
+ inactiveProperty :: RevertableProperty i -> Property x
+
+> The x is unknown and cannot be deduced from the available types.
+>
+> What could be done, instead, is to make a `RevertableProperty i` specify
+> the info of both its sides. While this doesn't perfectly model
+> the info propigation, the types work. [[done]] --[[Joey]]