@@ -66,7 +66,14 @@ instance Query () where
66 crop _ _ = ()
66 crop _ _ = ()
68-- | The result of an absurd query is trivial; If you can ask the question, the
68-- | The result of an absurd query is trivial; If you can ask the question, the
69−-- answer cannot tell you anything you didn't already know
69+-- answer cannot tell you anything you didn't already know.
71+-- 'QueryResult Void = @Void@' seems like it would also work, but that has
72+-- problems of robustness. In some applications, an unasked question can still
73+-- be answered, so it is important that the result is inhabited even when the
74+-- question isn't. Applications that wish to prevent this can mandate that the
75+-- query result be paired with the query: then the whole response will be
76+-- uninhabited as desired.
70instance Query Void where
77instance Query Void where
71 type QueryResult Void = ()
78 type QueryResult Void = ()
72 crop = absurd
79 crop = absurd
@@ -78,6 +85,7 @@ instance (Query q, Applicative f) => Query (Ap f q) where
78 type QueryResult (Ap f q) = Ap f (QueryResult q)
85 type QueryResult (Ap f q) = Ap f (QueryResult q)
79 crop = liftA2 crop
86 crop = liftA2 crop
81-- | QueryMorphism's must be group homomorphisms when acting on the query type
89-- | QueryMorphism's must be group homomorphisms when acting on the query type
82-- and compatible with the query relationship when acting on the query result.
90-- and compatible with the query relationship when acting on the query result.
83data QueryMorphism q q' = QueryMorphism
91data QueryMorphism q q' = QueryMorphism