diagrams / diagrams-lib

Diagrams standard library
https://diagrams.github.io/
Other
138 stars 62 forks source link

Make `bg` and `bgFrame` work for any query monoid #319

Closed AlexKnauth closed 6 years ago

AlexKnauth commented 6 years ago

Currently the bg function has the type:

(TypeableFloat n, Renderable (Path V2 n) b)
=>
Colour Double -> QDiagram b V2 n Any -> QDiagram b V2 n Any

With the Any monoid fixed.

This PR makes bg and bgFrame polymorphic over all monoids instead.

(TypeableFloat n, Renderable (Path V2 n) b, Monoid' q)
=>
Colour Double -> QDiagram b V2 n q -> QDiagram b V2 n q

Adding # bg color to a diagram shouldn't change the results of queries, so the background portion is given mempty for the query value.

Fixes #318.

byorgey commented 6 years ago

Makes sense. Thanks!