From 33da29496e1253550cac03675ce5435cda04ae8a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 27 Apr 2016 16:08:19 -0400 Subject: thoughts --- doc/todo/type_level_port_conflict_detection.mdwn | 27 ++++++++++++------------ 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'doc/todo/type_level_port_conflict_detection.mdwn') diff --git a/doc/todo/type_level_port_conflict_detection.mdwn b/doc/todo/type_level_port_conflict_detection.mdwn index 8209740e..8aa8d026 100644 --- a/doc/todo/type_level_port_conflict_detection.mdwn +++ b/doc/todo/type_level_port_conflict_detection.mdwn @@ -58,7 +58,7 @@ but it is not yet integrated into the Property types. --[[Joey]] > > Maybe make a `using` that changes the metatypes of a property, > > adding a resource. That shortens what needs to be written some: > > -> > & virtualHost "example.com" "/var/www" `using` (port :: Port 80) +> > & virtualHost "example.com" "/var/www" `using` (port :: UsingPort 80) > > > > (`port` here is just an alias for `sing`, possibly constrained to only > > construct port singletons.) @@ -70,21 +70,20 @@ but it is not yet integrated into the Property types. --[[Joey]] > > > it to get a usable property. So in a way, by adding this advanced > > > type safety, we've lost the most fundamental type safety of all: > > > Functions must have the right parameters applied! +> > > +> > > Well then, let's require a parameter. > > > -> > > So, it would perhaps be better to have +> > > virtualHost :: Domain -> WebRoot -> Resource port -> RevertableProperty DebianLike DebianLike > > > -> > > virtualHost :: Domain -> WebRoot -> RevertableProperty (UsingPort 80 + DebianLike) DebianLike +> > > Make `Resource` only able to be constructed by `using`, +> > > so the user must say: > > > -> > > And then to make it use a different port, use `using`. -> > > -> > > This too has a problem; if the property is hard-coded to use port 80, -> > > then `using` won't change it, and again the type signature doesn't -> > > tell. Perhaps the thing to do is to indicate in the type when a port -> > > can be changed: -> > > -> > > virtualHost :: Domain -> WebRoot -> RevertableProperty (Changable (UsingPort 80) + DebianLike) DebianLike -> > > -> > > And then `using` would need to only be able to be applied when it -> > > changed a resource that is marked `Changable`. +> > > & virtualHost "example.com" "/var/www" `using` (port :: UsingPort 80) +> > > +> > > So the type of `using` would be something like: +> > > +> > > using :: (Resource r -> Property proptype) -> r -> Property (r + proptype) +> > > +> > > (Complicated some as it needs to also support RevertableProperty.) > > > > > > --[[Joey]] -- cgit v1.2.3