diff options
| author | Joey Hess <joeyh@joeyh.name> | 2014-12-07 20:31:22 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2014-12-07 21:52:14 -0400 |
| commit | 27d00296ec549e17ec94125dc82fb9f2fb0fb34f (patch) | |
| tree | f50c822adb1873294190bb6f709e1cc9f90aaa3b | |
| parent | ac0bedb90b2912e6fd3ca25fa478ebded9bca96e (diff) | |
update
| -rw-r--r-- | doc/todo/info_propigation_out_of_nested_properties.mdwn | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/doc/todo/info_propigation_out_of_nested_properties.mdwn b/doc/todo/info_propigation_out_of_nested_properties.mdwn index bc7deb36..e4bb443a 100644 --- a/doc/todo/info_propigation_out_of_nested_properties.mdwn +++ b/doc/todo/info_propigation_out_of_nested_properties.mdwn @@ -12,6 +12,7 @@ This works, but it's error-prone. Consider this example: Here, the Info of `foo` is not propigated out. Nor is `bar`'s Info. Of course, only one of them will be run, and only its info should be propigated out.. + ---- Currently, ensureProperty detects if it's called on a property with a @@ -73,8 +74,7 @@ that has no Info. Only allow calling ensureProperty on this new type. (Or, remove propertyInfo from Property, and add a new InfoProperty that has the info.) -This would surely work, but it adds a lot of complexity to property -combiators. Also, propertyList could only contain one type at a time, +But, propertyList can only contain one type at a time, not a mixed list of Property and SimpleProperty. Could a GADT be used instead? @@ -85,9 +85,21 @@ Could a GADT be used instead? data HasInfo data NoInfo - data Property i where - InfoProperty :: Desc -> Propellor Result -> Info -> Property HasInfo - SimpleProperty :: Desc -> Propellor Result -> Property NoInfo + data Property = IProperty (GProperty HasInfo) | SProperty (GProperty NoInfo) + + data GProperty i where + GIProperty :: Desc -> Propellor Result -> Info -> GProperty HasInfo + GSProperty :: Desc -> Propellor Result -> GProperty NoInfo + + ensureProperty :: GProperty NoInfo -> Propellor Result + ensureProperty (GSProperty d r) = r + +That works. I made a `gadtwip` git branch that elaborated on that, +to the point that Property.File compiles, but is otherwise +unfinished. Most definitions of `Property` need to be changed to +`GProperty NoInfo`, so that ensureProperty can call them. It's a big, +intrusive change, and it may complicate propellor too much. - ensureProperty :: Property NoInfo -> Propellor Result - ensureProperty (SimpleProperty d r) = r +(I may need to make instances of Prop for `GProperty NoInfo` and `GProperty +HasInfo`, if that's possible, and make more Property combinators work on +Prop.) |
