diff --git a/src/Diagrams/Align.hs b/src/Diagrams/Align.hs index 9406aa4e..f7601ac7 100644 --- a/src/Diagrams/Align.hs +++ b/src/Diagrams/Align.hs @@ -112,6 +112,15 @@ instance ( HasLinearMap v, InnerSpace v, OrderedField (Scalar v) ) => Alignable (QDiagram b v m) where defaultBoundary = envelopeBoundary +-- | Although the alignBy method for the (b -> a) instance is +-- sensible, there is no good implementation for +-- defaultBoundary. Instead, we provide a total method, but one that +-- is not sensible. This should not present a serious problem as long +-- as your use of Alignable happens through alignBy. +instance (HasOrigin a, Alignable a) => Alignable (b -> a) where + alignBy v d f b = alignBy v d (f b) + defaultBoundary _ _ = origin + -- | @align v@ aligns an enveloped object along the edge in the -- direction of @v@. That is, it moves the local origin in the -- direction of @v@ until it is on the edge of the envelope. (Note