bg' :: (TypeableFloat n, Renderable (Path V2 n) b, Monoid' q) =>
Colour Double -> QDiagram b V2 n q -> QDiagram b V2 n q
bg' c d = d <> boundingRect d # lwO 0 # fc c # value mempty
The # value mempty is the only added code, and it makes sense to me that the "background" of a diagram should produce mempty for the query value. In particular it should make it so that adding # bg color to a diagram doesn't change the results of queries.
Currently the
bg
function has the type:With the
Any
monoid fixed. Is there a reason for this? https://github.com/diagrams/diagrams-lib/blob/1f863bf987c8babff112fb235ba28aa31d4c667a/src/Diagrams/TwoD/Combinators.hs#L261-L264Why can't it be polymorphic in all monoids:
The
# value mempty
is the only added code, and it makes sense to me that the "background" of a diagram should producemempty
for the query value. In particular it should make it so that adding# bg color
to a diagram doesn't change the results of queries.