From ca536fabbae92f389eae422c93623047719c5a3d Mon Sep 17 00:00:00 2001 From: George Thomas Date: Wed, 29 Oct 2025 11:49:50 +0000 Subject: [PATCH] Add semigroup instance for located line trails --- src/Diagrams/Trail.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Diagrams/Trail.hs b/src/Diagrams/Trail.hs index c65fa965..0474e2dd 100644 --- a/src/Diagrams/Trail.hs +++ b/src/Diagrams/Trail.hs @@ -539,6 +539,11 @@ instance (Metric v, OrderedField n, Metric u, OrderedField n') _Snoc = _Wrapped . _Snoc . bimapping _Unwrapped id {-# INLINE _Snoc #-} +instance (Real n, Floating n, Metric v) + => Semigroup (Located (Trail' Line v n)) where + a@(Loc aLoc aLine) <> b@(Loc _ bLine) = + Loc aLoc (aLine <> lineFromOffsets [atStart b .-. atEnd a] <> bLine) + -------------------------------------------------- -- Extracting segments