summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/todo/type_level_port_conflict_detection.mdwn34
1 files changed, 29 insertions, 5 deletions
diff --git a/doc/todo/type_level_port_conflict_detection.mdwn b/doc/todo/type_level_port_conflict_detection.mdwn
index 67f63e03..8209740e 100644
--- a/doc/todo/type_level_port_conflict_detection.mdwn
+++ b/doc/todo/type_level_port_conflict_detection.mdwn
@@ -9,7 +9,7 @@ but it is not yet integrated into the Property types. --[[Joey]]
[[!tag user/joey]]
-> On `typed-os-requirements` branch, I have the UsingPort 80 singleton
+> On the `typed-os-requirements` branch, I have the UsingPort 80 singleton
> implemented. As soon as I tried to apply it to some apache properties
> though, I realized a problem -- If multiple apache vhosts are defined
> each as its own property, then each of those properties can't have
@@ -42,10 +42,10 @@ but it is not yet integrated into the Property types. --[[Joey]]
> > So, we'd start with a property definition that does not use any ports:
> >
> > virtualHost :: Domain -> WebRoot -> RevertableProperty DebianLike DebianLike
-> > virtualHost domain docroot =
-> > let self = property "vhost" (go (usedPorts (getMetaTypes self)))
-> > in self
-> > where
+> > virtualHost domain docroot =
+> > let self = property "vhost" (go (usedPorts (getMetaTypes self)))
+> > in self
+> > where
> > go [] = error "No ports specified"
> > go ports = ...
> >
@@ -64,3 +64,27 @@ but it is not yet integrated into the Property types. --[[Joey]]
> > construct port singletons.)
> >
> > --[[Joey]]
+
+> > > A further problem with this is that it's not clear from the
+> > > `virtualHost` type signature that it needs to have a port applied to
+> > > 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!
+> > >
+> > > So, it would perhaps be better to have
+> > >
+> > > virtualHost :: Domain -> WebRoot -> RevertableProperty (UsingPort 80 + DebianLike) DebianLike
+> > >
+> > > 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`.
+> > >
+> > > --[[Joey]]