packages feed

diagrams-lib 1.4.1 → 1.4.1.1

raw patch · 6 files changed

+43/−10 lines, 6 filesdep ~distributivePVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: distributive

API changes (from Hackage documentation)

- Diagrams.Segment: oeEnvelope :: forall v_a1dG2 n_a1dG3. Lens' (OffsetEnvelope v_a1dG2 n_a1dG3) (Envelope v_a1dG2 n_a1dG3)
+ Diagrams.Segment: oeEnvelope :: forall v_a1dJ1 n_a1dJ2. Lens' (OffsetEnvelope v_a1dJ1 n_a1dJ2) (Envelope v_a1dJ1 n_a1dJ2)
- Diagrams.Segment: oeOffset :: forall v_a1dG2 n_a1dG3. Lens' (OffsetEnvelope v_a1dG2 n_a1dG3) (TotalOffset v_a1dG2 n_a1dG3)
+ Diagrams.Segment: oeOffset :: forall v_a1dJ1 n_a1dJ2. Lens' (OffsetEnvelope v_a1dJ1 n_a1dJ2) (TotalOffset v_a1dJ1 n_a1dJ2)
- Diagrams.ThreeD.Camera: horizontalFieldOfView :: forall n_aRpb. Lens' (PerspectiveLens n_aRpb) (Angle n_aRpb)
+ Diagrams.ThreeD.Camera: horizontalFieldOfView :: forall n_aRrx. Lens' (PerspectiveLens n_aRrx) (Angle n_aRrx)
- Diagrams.ThreeD.Camera: orthoHeight :: forall n_aRrp. Lens' (OrthoLens n_aRrp) n_aRrp
+ Diagrams.ThreeD.Camera: orthoHeight :: forall n_aRtL. Lens' (OrthoLens n_aRtL) n_aRtL
- Diagrams.ThreeD.Camera: orthoWidth :: forall n_aRrp. Lens' (OrthoLens n_aRrp) n_aRrp
+ Diagrams.ThreeD.Camera: orthoWidth :: forall n_aRtL. Lens' (OrthoLens n_aRtL) n_aRtL
- Diagrams.ThreeD.Camera: verticalFieldOfView :: forall n_aRpb. Lens' (PerspectiveLens n_aRpb) (Angle n_aRpb)
+ Diagrams.ThreeD.Camera: verticalFieldOfView :: forall n_aRrx. Lens' (PerspectiveLens n_aRrx) (Angle n_aRrx)
- Diagrams.Transform.ScaleInv: scaleInvDir :: forall t_a14KY. Lens' (ScaleInv t_a14KY) (Vn t_a14KY)
+ Diagrams.Transform.ScaleInv: scaleInvDir :: forall t_a14NM. Lens' (ScaleInv t_a14NM) (Vn t_a14NM)
- Diagrams.Transform.ScaleInv: scaleInvLoc :: forall t_a14KY. Lens' (ScaleInv t_a14KY) (Point (V t_a14KY) (N t_a14KY))
+ Diagrams.Transform.ScaleInv: scaleInvLoc :: forall t_a14NM. Lens' (ScaleInv t_a14NM) (Point (V t_a14NM) (N t_a14NM))
- Diagrams.Transform.ScaleInv: scaleInvObj :: forall t_a14KY. Lens' (ScaleInv t_a14KY) t_a14KY
+ Diagrams.Transform.ScaleInv: scaleInvObj :: forall t_a14NM. Lens' (ScaleInv t_a14NM) t_a14NM
- Diagrams.TwoD: _LG :: forall n_a27LF. Prism' (Texture n_a27LF) (LGradient n_a27LF)
+ Diagrams.TwoD: _LG :: forall n_a27Rs. Prism' (Texture n_a27Rs) (LGradient n_a27Rs)
- Diagrams.TwoD: _RG :: forall n_a27LF. Prism' (Texture n_a27LF) (RGradient n_a27LF)
+ Diagrams.TwoD: _RG :: forall n_a27Rs. Prism' (Texture n_a27Rs) (RGradient n_a27Rs)
- Diagrams.TwoD: _SC :: forall n_a27LF. Prism' (Texture n_a27LF) SomeColor
+ Diagrams.TwoD: _SC :: forall n_a27Rs. Prism' (Texture n_a27Rs) SomeColor
- Diagrams.TwoD: eColor :: forall n_a2mrJ. Lens' (EnvelopeOpts n_a2mrJ) (Colour Double)
+ Diagrams.TwoD: eColor :: forall n_a2mxF. Lens' (EnvelopeOpts n_a2mxF) (Colour Double)
- Diagrams.TwoD: eLineWidth :: forall n_a2mrJ n_a2mtI. Lens (EnvelopeOpts n_a2mrJ) (EnvelopeOpts n_a2mtI) (Measure n_a2mrJ) (Measure n_a2mtI)
+ Diagrams.TwoD: eLineWidth :: forall n_a2mxF n_a2mzE. Lens (EnvelopeOpts n_a2mxF) (EnvelopeOpts n_a2mzE) (Measure n_a2mxF) (Measure n_a2mzE)
- Diagrams.TwoD: ePoints :: forall n_a2mrJ. Lens' (EnvelopeOpts n_a2mrJ) Int
+ Diagrams.TwoD: ePoints :: forall n_a2mxF. Lens' (EnvelopeOpts n_a2mxF) Int
- Diagrams.TwoD: oColor :: forall n_a2mqQ. Lens' (OriginOpts n_a2mqQ) (Colour Double)
+ Diagrams.TwoD: oColor :: forall n_a2mwM. Lens' (OriginOpts n_a2mwM) (Colour Double)
- Diagrams.TwoD: oMinSize :: forall n_a2mqQ. Lens' (OriginOpts n_a2mqQ) n_a2mqQ
+ Diagrams.TwoD: oMinSize :: forall n_a2mwM. Lens' (OriginOpts n_a2mwM) n_a2mwM
- Diagrams.TwoD: oScale :: forall n_a2mqQ. Lens' (OriginOpts n_a2mqQ) n_a2mqQ
+ Diagrams.TwoD: oScale :: forall n_a2mwM. Lens' (OriginOpts n_a2mwM) n_a2mwM
- Diagrams.TwoD: radiusBL :: forall d_a2Ayz. Lens' (RoundedRectOpts d_a2Ayz) d_a2Ayz
+ Diagrams.TwoD: radiusBL :: forall d_a2AEv. Lens' (RoundedRectOpts d_a2AEv) d_a2AEv
- Diagrams.TwoD: radiusBR :: forall d_a2Ayz. Lens' (RoundedRectOpts d_a2Ayz) d_a2Ayz
+ Diagrams.TwoD: radiusBR :: forall d_a2AEv. Lens' (RoundedRectOpts d_a2AEv) d_a2AEv
- Diagrams.TwoD: radiusTL :: forall d_a2Ayz. Lens' (RoundedRectOpts d_a2Ayz) d_a2Ayz
+ Diagrams.TwoD: radiusTL :: forall d_a2AEv. Lens' (RoundedRectOpts d_a2AEv) d_a2AEv
- Diagrams.TwoD: radiusTR :: forall d_a2Ayz. Lens' (RoundedRectOpts d_a2Ayz) d_a2Ayz
+ Diagrams.TwoD: radiusTR :: forall d_a2AEv. Lens' (RoundedRectOpts d_a2AEv) d_a2AEv
- Diagrams.TwoD: tColor :: forall n_a2mu7. Lens' (TraceOpts n_a2mu7) (Colour Double)
+ Diagrams.TwoD: tColor :: forall n_a2mA3. Lens' (TraceOpts n_a2mA3) (Colour Double)
- Diagrams.TwoD: tMinSize :: forall n_a2mu7. Lens' (TraceOpts n_a2mu7) n_a2mu7
+ Diagrams.TwoD: tMinSize :: forall n_a2mA3. Lens' (TraceOpts n_a2mA3) n_a2mA3
- Diagrams.TwoD: tPoints :: forall n_a2mu7. Lens' (TraceOpts n_a2mu7) Int
+ Diagrams.TwoD: tPoints :: forall n_a2mA3. Lens' (TraceOpts n_a2mA3) Int
- Diagrams.TwoD: tScale :: forall n_a2mu7. Lens' (TraceOpts n_a2mu7) n_a2mu7
+ Diagrams.TwoD: tScale :: forall n_a2mA3. Lens' (TraceOpts n_a2mA3) n_a2mA3
- Diagrams.TwoD.Attributes: _LG :: forall n_a27LF. Prism' (Texture n_a27LF) (LGradient n_a27LF)
+ Diagrams.TwoD.Attributes: _LG :: forall n_a27Rs. Prism' (Texture n_a27Rs) (LGradient n_a27Rs)
- Diagrams.TwoD.Attributes: _RG :: forall n_a27LF. Prism' (Texture n_a27LF) (RGradient n_a27LF)
+ Diagrams.TwoD.Attributes: _RG :: forall n_a27Rs. Prism' (Texture n_a27Rs) (RGradient n_a27Rs)
- Diagrams.TwoD.Attributes: _SC :: forall n_a27LF. Prism' (Texture n_a27LF) SomeColor
+ Diagrams.TwoD.Attributes: _SC :: forall n_a27Rs. Prism' (Texture n_a27Rs) SomeColor
- Diagrams.TwoD.Model: eColor :: forall n_a2mrJ. Lens' (EnvelopeOpts n_a2mrJ) (Colour Double)
+ Diagrams.TwoD.Model: eColor :: forall n_a2mxF. Lens' (EnvelopeOpts n_a2mxF) (Colour Double)
- Diagrams.TwoD.Model: eLineWidth :: forall n_a2mrJ n_a2mtI. Lens (EnvelopeOpts n_a2mrJ) (EnvelopeOpts n_a2mtI) (Measure n_a2mrJ) (Measure n_a2mtI)
+ Diagrams.TwoD.Model: eLineWidth :: forall n_a2mxF n_a2mzE. Lens (EnvelopeOpts n_a2mxF) (EnvelopeOpts n_a2mzE) (Measure n_a2mxF) (Measure n_a2mzE)
- Diagrams.TwoD.Model: ePoints :: forall n_a2mrJ. Lens' (EnvelopeOpts n_a2mrJ) Int
+ Diagrams.TwoD.Model: ePoints :: forall n_a2mxF. Lens' (EnvelopeOpts n_a2mxF) Int
- Diagrams.TwoD.Model: oColor :: forall n_a2mqQ. Lens' (OriginOpts n_a2mqQ) (Colour Double)
+ Diagrams.TwoD.Model: oColor :: forall n_a2mwM. Lens' (OriginOpts n_a2mwM) (Colour Double)
- Diagrams.TwoD.Model: oMinSize :: forall n_a2mqQ. Lens' (OriginOpts n_a2mqQ) n_a2mqQ
+ Diagrams.TwoD.Model: oMinSize :: forall n_a2mwM. Lens' (OriginOpts n_a2mwM) n_a2mwM
- Diagrams.TwoD.Model: oScale :: forall n_a2mqQ. Lens' (OriginOpts n_a2mqQ) n_a2mqQ
+ Diagrams.TwoD.Model: oScale :: forall n_a2mwM. Lens' (OriginOpts n_a2mwM) n_a2mwM
- Diagrams.TwoD.Model: tColor :: forall n_a2mu7. Lens' (TraceOpts n_a2mu7) (Colour Double)
+ Diagrams.TwoD.Model: tColor :: forall n_a2mA3. Lens' (TraceOpts n_a2mA3) (Colour Double)
- Diagrams.TwoD.Model: tMinSize :: forall n_a2mu7. Lens' (TraceOpts n_a2mu7) n_a2mu7
+ Diagrams.TwoD.Model: tMinSize :: forall n_a2mA3. Lens' (TraceOpts n_a2mA3) n_a2mA3
- Diagrams.TwoD.Model: tPoints :: forall n_a2mu7. Lens' (TraceOpts n_a2mu7) Int
+ Diagrams.TwoD.Model: tPoints :: forall n_a2mA3. Lens' (TraceOpts n_a2mA3) Int
- Diagrams.TwoD.Model: tScale :: forall n_a2mu7. Lens' (TraceOpts n_a2mu7) n_a2mu7
+ Diagrams.TwoD.Model: tScale :: forall n_a2mA3. Lens' (TraceOpts n_a2mA3) n_a2mA3
- Diagrams.TwoD.Shapes: radiusBL :: forall d_a2Ayz. Lens' (RoundedRectOpts d_a2Ayz) d_a2Ayz
+ Diagrams.TwoD.Shapes: radiusBL :: forall d_a2AEv. Lens' (RoundedRectOpts d_a2AEv) d_a2AEv
- Diagrams.TwoD.Shapes: radiusBR :: forall d_a2Ayz. Lens' (RoundedRectOpts d_a2Ayz) d_a2Ayz
+ Diagrams.TwoD.Shapes: radiusBR :: forall d_a2AEv. Lens' (RoundedRectOpts d_a2AEv) d_a2AEv
- Diagrams.TwoD.Shapes: radiusTL :: forall d_a2Ayz. Lens' (RoundedRectOpts d_a2Ayz) d_a2Ayz
+ Diagrams.TwoD.Shapes: radiusTL :: forall d_a2AEv. Lens' (RoundedRectOpts d_a2AEv) d_a2AEv
- Diagrams.TwoD.Shapes: radiusTR :: forall d_a2Ayz. Lens' (RoundedRectOpts d_a2Ayz) d_a2Ayz
+ Diagrams.TwoD.Shapes: radiusTR :: forall d_a2AEv. Lens' (RoundedRectOpts d_a2AEv) d_a2AEv

Files

CHANGELOG.md view
@@ -1,4 +1,11 @@-## [v1.4.1](https://github.com/diagrams/diagrams-lib/tree/v1.4.0.1) (2017-05-28)+## [v1.4.1.1](https://github.com/diagrams/diagrams-lib/tree/v1.4.1.1) (2017-06-06)++- Fix `Diagrams.Points.centroid` to make it total.+- Fix bug in `Diagrams.Transform.Matrix.fromMatWithInv` (and hence+  also related functions which called it, such as `fromMat22` and+  `fromMat33`).++## [v1.4.1](https://github.com/diagrams/diagrams-lib/tree/v1.4.1) (2017-05-28)  - New functions `embeddedImage` and `loadImageEmbBS` for loading   images.
diagrams-lib.cabal view
@@ -1,5 +1,5 @@ Name:                diagrams-lib-Version:             1.4.1+Version:             1.4.1.1 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@@ -163,6 +163,7 @@                        deepseq >= 1.3 && < 1.5,                        diagrams-lib,                        lens,+                       distributive,                        numeric-extras,                        diagrams-solve   default-language:    Haskell2010
src/Diagrams/Points.hs view
@@ -29,8 +29,11 @@ import           Linear.Vector  -- | The centroid of a set of /n/ points is their sum divided by /n/.+--   Returns the origin for an empty list of points. centroid :: (Additive v, Fractional n) => [Point v n] -> Point v n-centroid = meanV+centroid [] = origin+centroid ps = meanV ps+{-# INLINE centroid #-}  meanV :: (Foldable f, Additive v, Fractional a) => f (v a) -> v a meanV = uncurry (^/) . F.foldl' (\(s,c) e -> (e ^+^ s,c+1)) (zero,0)
src/Diagrams/Transform/Matrix.hs view
@@ -40,13 +40,13 @@ --   translation vector. Does not check if the matrix is not invertible --   (in which case the 'T2' will be invalid). fromMat22 :: Floating n => M22 n -> V2 n -> T2 n-fromMat22 m v = flip (fromMatWithInv m) v $ inv22 m+fromMat22 m v = fromMatWithInv m (inv22 m) v  -- | Make a 3D transformation from a 3x3 transform matrix and a --   translation vector. Does not check if the matrix is not invertible --   (in which case the 'T3' will be invalid). fromMat33 :: Floating n => M33 n -> V3 n -> T3 n-fromMat33 m v = flip (fromMatWithInv m) v $ inv33 m+fromMat33 m v = fromMatWithInv m (inv33 m) v  -- | Build a transform with a maxtrix along with its inverse. fromMatWithInv :: (Additive v, Distributive v, F.Foldable v, Num n)@@ -55,8 +55,8 @@   -> v n     -- ^ translation   -> Transformation v n fromMatWithInv m m_ v =-  Transformation ((*! m)            <-> (*! m_))-                 ((*! distribute m) <-> (*! distribute m_))+  Transformation ((m !*)            <-> (m_ !*))+                 ((distribute m !*) <-> (distribute m_ !*))                  v  -- | Prism onto a 2D transformation from a 2x2 transform matrix and
test/Instances.hs view
@@ -13,7 +13,8 @@  import           Diagrams.Prelude import           Numeric.Extras-import           Test.Tasty.QuickCheck+import           Test.Tasty.QuickCheck (Arbitrary(..), Gen)+import qualified Test.Tasty.QuickCheck as QC  ------------------------------------------------------------     -- Approximate Comparison for Doubles, Points@@ -36,6 +37,9 @@ instance Approx n => Approx (V2 n) where     z1 =~ z2 = (z1^._x) =~ (z2^._x) && (z1^._y) =~ (z2^._y) +instance Approx n => Approx (V3 n) where+    z1 =~ z2 = (z1^._x) =~ (z2^._x) && (z1^._y) =~ (z2^._y) && (z1^._z) =~ (z2^._z)+ instance Approx (v n) => Approx (Point v n) where     p =~ q = view _Point p =~ view _Point q @@ -86,10 +90,26 @@     arbitrary = (^&) <$> arbitrary <*> arbitrary     shrink (coords -> x :& y) = (^&) <$> shrink x <*> shrink y +instance Arbitrary n => Arbitrary (V3 n) where+    arbitrary = V3 <$> arbitrary <*> arbitrary <*> arbitrary+    shrink (coords -> x :& y :& z) = V3 <$> shrink x <*> shrink y <*> shrink z+ instance Arbitrary (v n) => Arbitrary (Point v n) where     arbitrary = P <$> arbitrary     shrink (P v) = P <$> shrink v +instance (Arbitrary n, Floating n, Ord n) => Arbitrary (Transformation V2 n) where+    arbitrary = QC.sized arbT+      where+        arbT 0 = return mempty+        arbT n = QC.oneof+          [ rotation    <$> arbitrary+          , scaling     <$> arbitrary+          , translation <$> arbitrary+          , reflectionAbout <$> arbitrary <*> arbitrary+          , (<>) <$> arbT (n `div` 2) <*> arbT (n `div` 2)+          ]+ instance Arbitrary n => Arbitrary (Angle n) where     arbitrary = review rad <$> arbitrary @@ -114,7 +134,7 @@ --    shrink (OffsetClosed x) = OffsetClosed <$> shrink x  instance Arbitrary n =>  Arbitrary (Segment Closed V2 n) where-    arbitrary = oneof [Linear <$> arbitrary, Cubic <$> arbitrary <*> arbitrary <*> arbitrary]+    arbitrary = QC.oneof [Linear <$> arbitrary, Cubic <$> arbitrary <*> arbitrary <*> arbitrary]     -- shrink (Linear x) = Linear <$> shrink x     -- shrink (Cubic x y z) = Linear z     --                      : [Cubic x' y' z' | (x',y',z') <- shrink (x,y,z)]@@ -128,5 +148,5 @@ --    shrink (cutLoop -> l) = closeLine <$> shrink l  instance (Arbitrary n, Floating n, Ord n) => Arbitrary (Trail V2 n) where-    arbitrary = oneof [Trail <$> (arbitrary :: Gen (Trail' Loop V2 n)), Trail <$> (arbitrary :: Gen (Trail' Line V2 n))]+    arbitrary = QC.oneof [Trail <$> (arbitrary :: Gen (Trail' Loop V2 n)), Trail <$> (arbitrary :: Gen (Trail' Line V2 n))] 
test/Test.hs view
@@ -3,6 +3,7 @@ import qualified Diagrams.Test.Angle       as Angle import qualified Diagrams.Test.Direction   as Direction import qualified Diagrams.Test.Transform   as Transform+import qualified Diagrams.Test.Transform.Matrix   as TransformMatrix import qualified Diagrams.Test.TwoD        as TwoD import qualified Diagrams.Test.TwoD.Offset as TwoD.Offset @@ -15,6 +16,7 @@     , Angle.tests     , Direction.tests     , Transform.tests+    , TransformMatrix.tests     , Trail.tests     ]