diagrams-lib 1.4.6.1 → 1.4.6.2
raw patch · 7 files changed
+67/−31 lines, 7 filesdep ~basedep ~containersdep ~filepathPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base, containers, filepath, hashable, lens, linear, tagged, tasty-quickcheck
API changes (from Hackage documentation)
- Diagrams.Segment: oeEnvelope :: forall v_aUi0 n_aUi1. Lens' (OffsetEnvelope v_aUi0 n_aUi1) (Envelope v_aUi0 n_aUi1)
+ Diagrams.Segment: oeEnvelope :: forall v_aUsg n_aUsh. Lens' (OffsetEnvelope v_aUsg n_aUsh) (Envelope v_aUsg n_aUsh)
- Diagrams.Segment: oeOffset :: forall v_aUi0 n_aUi1. Lens' (OffsetEnvelope v_aUi0 n_aUi1) (TotalOffset v_aUi0 n_aUi1)
+ Diagrams.Segment: oeOffset :: forall v_aUsg n_aUsh. Lens' (OffsetEnvelope v_aUsg n_aUsh) (TotalOffset v_aUsg n_aUsh)
- Diagrams.ThreeD.Camera: horizontalFieldOfView :: forall n_aJ53. Lens' (PerspectiveLens n_aJ53) (Angle n_aJ53)
+ Diagrams.ThreeD.Camera: horizontalFieldOfView :: forall n_aJdA. Lens' (PerspectiveLens n_aJdA) (Angle n_aJdA)
- Diagrams.ThreeD.Camera: orthoHeight :: forall n_aJ7Q. Lens' (OrthoLens n_aJ7Q) n_aJ7Q
+ Diagrams.ThreeD.Camera: orthoHeight :: forall n_aJgn. Lens' (OrthoLens n_aJgn) n_aJgn
- Diagrams.ThreeD.Camera: orthoWidth :: forall n_aJ7Q. Lens' (OrthoLens n_aJ7Q) n_aJ7Q
+ Diagrams.ThreeD.Camera: orthoWidth :: forall n_aJgn. Lens' (OrthoLens n_aJgn) n_aJgn
- Diagrams.ThreeD.Camera: verticalFieldOfView :: forall n_aJ53. Lens' (PerspectiveLens n_aJ53) (Angle n_aJ53)
+ Diagrams.ThreeD.Camera: verticalFieldOfView :: forall n_aJdA. Lens' (PerspectiveLens n_aJdA) (Angle n_aJdA)
- Diagrams.Transform.ScaleInv: scaleInvDir :: forall t_aCen. Lens' (ScaleInv t_aCen) (Vn t_aCen)
+ Diagrams.Transform.ScaleInv: scaleInvDir :: forall t_aCmU. Lens' (ScaleInv t_aCmU) (Vn t_aCmU)
- Diagrams.Transform.ScaleInv: scaleInvLoc :: forall t_aCen. Lens' (ScaleInv t_aCen) (Point (V t_aCen) (N t_aCen))
+ Diagrams.Transform.ScaleInv: scaleInvLoc :: forall t_aCmU. Lens' (ScaleInv t_aCmU) (Point (V t_aCmU) (N t_aCmU))
- Diagrams.Transform.ScaleInv: scaleInvObj :: forall t_aCen. Lens' (ScaleInv t_aCen) t_aCen
+ Diagrams.Transform.ScaleInv: scaleInvObj :: forall t_aCmU. Lens' (ScaleInv t_aCmU) t_aCmU
- Diagrams.TwoD: _LG :: forall n_a1RM1. Prism' (Texture n_a1RM1) (LGradient n_a1RM1)
+ Diagrams.TwoD: _LG :: forall n_a1RWB. Prism' (Texture n_a1RWB) (LGradient n_a1RWB)
- Diagrams.TwoD: _RG :: forall n_a1RM1. Prism' (Texture n_a1RM1) (RGradient n_a1RM1)
+ Diagrams.TwoD: _RG :: forall n_a1RWB. Prism' (Texture n_a1RWB) (RGradient n_a1RWB)
- Diagrams.TwoD: _SC :: forall n_a1RM1. Prism' (Texture n_a1RM1) SomeColor
+ Diagrams.TwoD: _SC :: forall n_a1RWB. Prism' (Texture n_a1RWB) SomeColor
- Diagrams.TwoD: eColor :: forall n_a2ams. Lens' (EnvelopeOpts n_a2ams) (Colour Double)
+ Diagrams.TwoD: eColor :: forall n_a2awZ. Lens' (EnvelopeOpts n_a2awZ) (Colour Double)
- Diagrams.TwoD: eLineWidth :: forall n_a2ams n_a2apr. Lens (EnvelopeOpts n_a2ams) (EnvelopeOpts n_a2apr) (Measure n_a2ams) (Measure n_a2apr)
+ Diagrams.TwoD: eLineWidth :: forall n_a2awZ n_a2azY. Lens (EnvelopeOpts n_a2awZ) (EnvelopeOpts n_a2azY) (Measure n_a2awZ) (Measure n_a2azY)
- Diagrams.TwoD: ePoints :: forall n_a2ams. Lens' (EnvelopeOpts n_a2ams) Int
+ Diagrams.TwoD: ePoints :: forall n_a2awZ. Lens' (EnvelopeOpts n_a2awZ) Int
- Diagrams.TwoD: oColor :: forall n_a2aln. Lens' (OriginOpts n_a2aln) (Colour Double)
+ Diagrams.TwoD: oColor :: forall n_a2avU. Lens' (OriginOpts n_a2avU) (Colour Double)
- Diagrams.TwoD: oMinSize :: forall n_a2aln. Lens' (OriginOpts n_a2aln) n_a2aln
+ Diagrams.TwoD: oMinSize :: forall n_a2avU. Lens' (OriginOpts n_a2avU) n_a2avU
- Diagrams.TwoD: oScale :: forall n_a2aln. Lens' (OriginOpts n_a2aln) n_a2aln
+ Diagrams.TwoD: oScale :: forall n_a2avU. Lens' (OriginOpts n_a2avU) n_a2avU
- Diagrams.TwoD: radiusBL :: forall d_a1Gbs. Lens' (RoundedRectOpts d_a1Gbs) d_a1Gbs
+ Diagrams.TwoD: radiusBL :: forall d_a1Glt. Lens' (RoundedRectOpts d_a1Glt) d_a1Glt
- Diagrams.TwoD: radiusBR :: forall d_a1Gbs. Lens' (RoundedRectOpts d_a1Gbs) d_a1Gbs
+ Diagrams.TwoD: radiusBR :: forall d_a1Glt. Lens' (RoundedRectOpts d_a1Glt) d_a1Glt
- Diagrams.TwoD: radiusTL :: forall d_a1Gbs. Lens' (RoundedRectOpts d_a1Gbs) d_a1Gbs
+ Diagrams.TwoD: radiusTL :: forall d_a1Glt. Lens' (RoundedRectOpts d_a1Glt) d_a1Glt
- Diagrams.TwoD: radiusTR :: forall d_a1Gbs. Lens' (RoundedRectOpts d_a1Gbs) d_a1Gbs
+ Diagrams.TwoD: radiusTR :: forall d_a1Glt. Lens' (RoundedRectOpts d_a1Glt) d_a1Glt
- Diagrams.TwoD: tColor :: forall n_a2apQ. Lens' (TraceOpts n_a2apQ) (Colour Double)
+ Diagrams.TwoD: tColor :: forall n_a2aAn. Lens' (TraceOpts n_a2aAn) (Colour Double)
- Diagrams.TwoD: tMinSize :: forall n_a2apQ. Lens' (TraceOpts n_a2apQ) n_a2apQ
+ Diagrams.TwoD: tMinSize :: forall n_a2aAn. Lens' (TraceOpts n_a2aAn) n_a2aAn
- Diagrams.TwoD: tPoints :: forall n_a2apQ. Lens' (TraceOpts n_a2apQ) Int
+ Diagrams.TwoD: tPoints :: forall n_a2aAn. Lens' (TraceOpts n_a2aAn) Int
- Diagrams.TwoD: tScale :: forall n_a2apQ. Lens' (TraceOpts n_a2apQ) n_a2apQ
+ Diagrams.TwoD: tScale :: forall n_a2aAn. Lens' (TraceOpts n_a2aAn) n_a2aAn
- Diagrams.TwoD.Attributes: _LG :: forall n_a1RM1. Prism' (Texture n_a1RM1) (LGradient n_a1RM1)
+ Diagrams.TwoD.Attributes: _LG :: forall n_a1RWB. Prism' (Texture n_a1RWB) (LGradient n_a1RWB)
- Diagrams.TwoD.Attributes: _RG :: forall n_a1RM1. Prism' (Texture n_a1RM1) (RGradient n_a1RM1)
+ Diagrams.TwoD.Attributes: _RG :: forall n_a1RWB. Prism' (Texture n_a1RWB) (RGradient n_a1RWB)
- Diagrams.TwoD.Attributes: _SC :: forall n_a1RM1. Prism' (Texture n_a1RM1) SomeColor
+ Diagrams.TwoD.Attributes: _SC :: forall n_a1RWB. Prism' (Texture n_a1RWB) SomeColor
- Diagrams.TwoD.Model: eColor :: forall n_a2ams. Lens' (EnvelopeOpts n_a2ams) (Colour Double)
+ Diagrams.TwoD.Model: eColor :: forall n_a2awZ. Lens' (EnvelopeOpts n_a2awZ) (Colour Double)
- Diagrams.TwoD.Model: eLineWidth :: forall n_a2ams n_a2apr. Lens (EnvelopeOpts n_a2ams) (EnvelopeOpts n_a2apr) (Measure n_a2ams) (Measure n_a2apr)
+ Diagrams.TwoD.Model: eLineWidth :: forall n_a2awZ n_a2azY. Lens (EnvelopeOpts n_a2awZ) (EnvelopeOpts n_a2azY) (Measure n_a2awZ) (Measure n_a2azY)
- Diagrams.TwoD.Model: ePoints :: forall n_a2ams. Lens' (EnvelopeOpts n_a2ams) Int
+ Diagrams.TwoD.Model: ePoints :: forall n_a2awZ. Lens' (EnvelopeOpts n_a2awZ) Int
- Diagrams.TwoD.Model: oColor :: forall n_a2aln. Lens' (OriginOpts n_a2aln) (Colour Double)
+ Diagrams.TwoD.Model: oColor :: forall n_a2avU. Lens' (OriginOpts n_a2avU) (Colour Double)
- Diagrams.TwoD.Model: oMinSize :: forall n_a2aln. Lens' (OriginOpts n_a2aln) n_a2aln
+ Diagrams.TwoD.Model: oMinSize :: forall n_a2avU. Lens' (OriginOpts n_a2avU) n_a2avU
- Diagrams.TwoD.Model: oScale :: forall n_a2aln. Lens' (OriginOpts n_a2aln) n_a2aln
+ Diagrams.TwoD.Model: oScale :: forall n_a2avU. Lens' (OriginOpts n_a2avU) n_a2avU
- Diagrams.TwoD.Model: tColor :: forall n_a2apQ. Lens' (TraceOpts n_a2apQ) (Colour Double)
+ Diagrams.TwoD.Model: tColor :: forall n_a2aAn. Lens' (TraceOpts n_a2aAn) (Colour Double)
- Diagrams.TwoD.Model: tMinSize :: forall n_a2apQ. Lens' (TraceOpts n_a2apQ) n_a2apQ
+ Diagrams.TwoD.Model: tMinSize :: forall n_a2aAn. Lens' (TraceOpts n_a2aAn) n_a2aAn
- Diagrams.TwoD.Model: tPoints :: forall n_a2apQ. Lens' (TraceOpts n_a2apQ) Int
+ Diagrams.TwoD.Model: tPoints :: forall n_a2aAn. Lens' (TraceOpts n_a2aAn) Int
- Diagrams.TwoD.Model: tScale :: forall n_a2apQ. Lens' (TraceOpts n_a2apQ) n_a2apQ
+ Diagrams.TwoD.Model: tScale :: forall n_a2aAn. Lens' (TraceOpts n_a2aAn) n_a2aAn
- Diagrams.TwoD.Shapes: radiusBL :: forall d_a1Gbs. Lens' (RoundedRectOpts d_a1Gbs) d_a1Gbs
+ Diagrams.TwoD.Shapes: radiusBL :: forall d_a1Glt. Lens' (RoundedRectOpts d_a1Glt) d_a1Glt
- Diagrams.TwoD.Shapes: radiusBR :: forall d_a1Gbs. Lens' (RoundedRectOpts d_a1Gbs) d_a1Gbs
+ Diagrams.TwoD.Shapes: radiusBR :: forall d_a1Glt. Lens' (RoundedRectOpts d_a1Glt) d_a1Glt
- Diagrams.TwoD.Shapes: radiusTL :: forall d_a1Gbs. Lens' (RoundedRectOpts d_a1Gbs) d_a1Gbs
+ Diagrams.TwoD.Shapes: radiusTL :: forall d_a1Glt. Lens' (RoundedRectOpts d_a1Glt) d_a1Glt
- Diagrams.TwoD.Shapes: radiusTR :: forall d_a1Gbs. Lens' (RoundedRectOpts d_a1Gbs) d_a1Gbs
+ Diagrams.TwoD.Shapes: radiusTR :: forall d_a1Glt. Lens' (RoundedRectOpts d_a1Glt) d_a1Glt
Files
- CHANGELOG.md +7/−0
- diagrams-lib.cabal +5/−4
- src/Diagrams/Align.hs +3/−2
- src/Diagrams/BoundingBox.hs +2/−1
- src/Diagrams/CubicSpline/Boehm.hs +3/−2
- src/Diagrams/Segment.hs +23/−22
- src/Linear/Vector/Compat.hs +24/−0
CHANGELOG.md view
@@ -1,3 +1,10 @@+## [v1.4.6.2](https://github.com/diagrams/diagrams-lib/tree/v1.4.6.2) (2024-05-01)++- Support for `linear-1.23`. This version of `linear` introduces a+ breaking change, so add an internal compatibility module that allows+ diagrams to work with any version of `linear` both before and after+ the change.+ ## [v1.4.6.1](https://github.com/diagrams/diagrams-lib/tree/v1.4.6.1) (2024-02-26) - Fix compilation on BSD ([#367](https://github.com/diagrams/diagrams-lib/pull/367), thanks to Finn Espen Gundersen)
diagrams-lib.cabal view
@@ -1,5 +1,5 @@ Name: diagrams-lib-Version: 1.4.6.1+Version: 1.4.6.2 Synopsis: Embedded domain-specific language for declarative graphics Description: Diagrams is a flexible, extensible EDSL for creating graphics of many types. Graphics can be created@@ -100,6 +100,7 @@ Diagrams.TwoD.Types, Diagrams.TwoD.Vector, Diagrams.Util+ other-modules: Linear.Vector.Compat Build-depends: base >= 4.9 && < 4.20, containers >= 0.3 && < 0.7, array >= 0.3 && < 0.6,@@ -114,12 +115,12 @@ fingertree >= 0.1 && < 0.2, intervals >= 0.7 && < 0.10, lens >= 5.1 && < 5.3,- tagged >= 0.7,+ tagged >= 0.7 && < 0.9, optparse-applicative >= 0.11 && < 0.19,- filepath,+ filepath >= 1.4 && < 1.5, JuicyPixels >= 3.3.4 && < 3.4, hashable >= 1.1 && < 1.5,- linear >= 1.20.1 && < 1.23,+ linear >= 1.20.1 && < 1.24, adjunctions >= 4.0 && < 5.0, distributive >=0.2.2 && < 1.0, process >= 1.1 && < 1.7,
src/Diagrams/Align.hs view
@@ -52,7 +52,8 @@ import Linear.Affine import Linear.Metric-import Linear.Vector+import Linear.Vector (negated)+import Linear.Vector.Compat (lerp) -- | Class of things which can be aligned. class Alignable a where@@ -78,8 +79,8 @@ alignBy'Default :: (InSpace v n a, Fractional n, HasOrigin a) => (v n -> a -> Point v n) -> v n -> n -> a -> a alignBy'Default boundary v d a = moveOriginTo (lerp ((d + 1) / 2)- (boundary v a) (boundary (negated v) a)+ (boundary v a) ) a {-# ANN alignBy'Default ("HLint: ignore Use camelCase" :: String) #-}
src/Diagrams/BoundingBox.hs view
@@ -69,7 +69,8 @@ import Data.Traversable as T import Linear.Affine import Linear.Metric-import Linear.Vector+import Linear.Vector hiding (lerp)+import Linear.Vector.Compat (lerp) -- Unexported utility newtype
src/Diagrams/CubicSpline/Boehm.hs view
@@ -33,7 +33,8 @@ import Diagrams.Segment (FixedSegment (..), fromFixedSeg) import Diagrams.TrailLike (TrailLike, fromLocSegments) import Diagrams.Util (iterateN)-import Linear.Vector (Additive, lerp)+import Linear.Vector (Additive)+import Linear.Vector.Compat (lerp) type BSpline v n = [Point v n] @@ -41,7 +42,7 @@ -- which lies at parameter t, if x has parameter a and y has parameter b. -- The usual @lerp@ arises by giving x parameter 0 and y parameter 1. affineCombo :: (Additive f, Fractional a) => a -> a -> a -> f a -> f a -> f a-affineCombo a b t x y = lerp ((t-a)/(b-a)) y x+affineCombo a b t = lerp ((t-a)/(b-a)) -- | @windows k xs@ yields all the length-@k@ windows from @xs@, e.g. -- @windows 3 [a,b,c,d,e] == [[a,b,c], [b,c,d], [c,d,e]]@.
src/Diagrams/Segment.hs view
@@ -75,7 +75,8 @@ import Linear.Affine import Linear.Metric-import Linear.Vector+import Linear.Vector hiding (lerp)+import Linear.Vector.Compat (lerp) import Control.Applicative import Diagrams.Core hiding (Measured)@@ -308,16 +309,16 @@ splitAtParam (Linear (OffsetClosed x1)) t = (left, right) where left = straight p right = straight (x1 ^-^ p)- p = lerp t x1 zero+ p = lerp t zero x1 splitAtParam (Cubic c1 c2 (OffsetClosed x2)) t = (left, right) where left = bezier3 a b e right = bezier3 (c ^-^ e) (d ^-^ e) (x2 ^-^ e)- p = lerp t c2 c1- a = lerp t c1 zero- b = lerp t p a- d = lerp t x2 c2- c = lerp t d p- e = lerp t c b+ p = lerp t c1 c2+ a = lerp t zero c1+ b = lerp t a p+ d = lerp t c2 x2+ c = lerp t p d+ e = lerp t b c reverseDomain = reverseSegment @@ -426,16 +427,16 @@ type instance Codomain (FixedSegment v n) = Point v instance (Additive v, Num n) => Parametric (FixedSegment v n) where- atParam (FLinear p1 p2) t = lerp t p2 p1+ atParam (FLinear p1 p2) t = lerp t p1 p2 atParam (FCubic x1 c1 c2 x2) t = p3- where p11 = lerp t c1 x1- p12 = lerp t c2 c1- p13 = lerp t x2 c2+ where p11 = lerp t x1 c1+ p12 = lerp t c1 c2+ p13 = lerp t c2 x2 - p21 = lerp t p12 p11- p22 = lerp t p13 p12+ p21 = lerp t p11 p12+ p22 = lerp t p12 p13 - p3 = lerp t p22 p21+ p3 = lerp t p21 p22 instance Num n => DomainBounds (FixedSegment v n) @@ -449,19 +450,19 @@ splitAtParam (FLinear p0 p1) t = (left, right) where left = FLinear p0 p right = FLinear p p1- p = lerp t p1 p0+ p = lerp t p0 p1 splitAtParam (FCubic p0 c1 c2 p1) t = (left, right) where left = FCubic p0 a b cut right = FCubic cut c d p1 -- first round- a = lerp t c1 p0- p = lerp t c2 c1- d = lerp t p1 c2+ a = lerp t p0 c1+ p = lerp t c1 c2+ d = lerp t c2 p1 -- second round- b = lerp t p a- c = lerp t d p+ b = lerp t a p+ c = lerp t p d -- final round- cut = lerp t c b+ cut = lerp t b c reverseDomain (FLinear p0 p1) = FLinear p1 p0 reverseDomain (FCubic p0 c1 c2 p1) = FCubic p1 c2 c1 p0
+ src/Linear/Vector/Compat.hs view
@@ -0,0 +1,24 @@+{-# LANGUAGE CPP #-}++-- |+-- Module : Linear.Vector.Compat+-- Copyright : (c) 2024 diagrams-lib team (see LICENSE)+-- License : BSD-style (see LICENSE)+-- Maintainer : diagrams-discuss@googlegroups.com+--+-- Compatibility layer for working with versions of linear both before+-- (< 1.23) and after (>= 1.23) the interpolation direction of `lerp`+-- was reversed.+module Linear.Vector.Compat (lerp) where++import qualified Linear.Vector as V++-- | Linearly interpolate between two vectors, such that @lerp 0 x y =+-- x@ and @lerp 1 x y = 1@.+lerp :: (V.Additive f, Num a) => a -> f a -> f a -> f a+lerp =+#if MIN_VERSION_linear(1,23,0)+ V.lerp+#else+ V.lerp . (1-)+#endif