diagrams-lib 1.3.1.2 → 1.3.1.3
raw patch · 32 files changed
+106/−109 lines, 32 filesdep ~basedep ~colourdep ~data-default-class
Dependency ranges changed: base, colour, data-default-class, diagrams-core, process, transformers
Files
- CHANGELOG.md +8/−0
- diagrams-lib.cabal +6/−6
- src/Diagrams/Align.hs +1/−0
- src/Diagrams/Animation.hs +4/−4
- src/Diagrams/Attributes.hs +7/−7
- src/Diagrams/Backend/CmdLine.hs +2/−1
- src/Diagrams/BoundingBox.hs +6/−6
- src/Diagrams/Combinators.hs +2/−2
- src/Diagrams/Deform.hs +1/−1
- src/Diagrams/LinearMap.hs +3/−4
- src/Diagrams/Parametric/Adjust.hs +1/−1
- src/Diagrams/Path.hs +1/−1
- src/Diagrams/Prelude.hs +10/−1
- src/Diagrams/Size.hs +4/−4
- src/Diagrams/ThreeD/Align.hs +1/−4
- src/Diagrams/ThreeD/Camera.hs +2/−3
- src/Diagrams/ThreeD/Light.hs +1/−1
- src/Diagrams/Trail.hs +5/−11
- src/Diagrams/TrailLike.hs +1/−2
- src/Diagrams/Transform.hs +1/−1
- src/Diagrams/Transform/Matrix.hs +0/−3
- src/Diagrams/Transform/ScaleInv.hs +1/−1
- src/Diagrams/TwoD/Arrow.hs +1/−1
- src/Diagrams/TwoD/Arrowheads.hs +3/−3
- src/Diagrams/TwoD/Attributes.hs +1/−7
- src/Diagrams/TwoD/Combinators.hs +4/−5
- src/Diagrams/TwoD/Ellipse.hs +4/−4
- src/Diagrams/TwoD/Offset.hs +1/−1
- src/Diagrams/TwoD/Path.hs +2/−2
- src/Diagrams/TwoD/Polygons.hs +1/−1
- src/Diagrams/TwoD/Shapes.hs +15/−15
- src/Diagrams/TwoD/Text.hs +6/−6
CHANGELOG.md view
@@ -1,3 +1,11 @@+## [v1.3.1.3](https://github.com/diagrams/diagrams-lib/tree/v1.3.1.3) (2016-06-05)++- allow `base-4.9`+- allow `data-default-class-0.1`+- test with GHC 8.0.1++[Full Changelog](https://github.com/diagrams/diagrams-lib/compare/v1.3.1.2...v1.3.1.3)+ ## [v1.3.1.2](https://github.com/diagrams/diagrams-lib/tree/v1.3.1.2) (2016-05-01) - allow `lens-4.14`
diagrams-lib.cabal view
@@ -1,5 +1,5 @@ Name: diagrams-lib-Version: 1.3.1.2+Version: 1.3.1.3 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@@ -99,7 +99,7 @@ Diagrams.TwoD.Types, Diagrams.TwoD.Vector, Diagrams.Util- Build-depends: base >= 4.2 && < 4.9,+ Build-depends: base >= 4.2 && < 4.10, containers >= 0.3 && < 0.6, array >= 0.3 && < 0.6, semigroups >= 0.3.4 && < 0.19,@@ -109,7 +109,7 @@ diagrams-solve >= 0.1 && < 0.2, active >= 0.2 && < 0.3, colour >= 2.3.2 && < 2.4,- data-default-class < 0.1,+ data-default-class < 0.2, fingertree >= 0.1 && < 0.2, intervals >= 0.7 && < 0.8, lens >= 4.6 && < 4.15,@@ -121,13 +121,13 @@ linear >= 1.20.1 && < 1.21, adjunctions >= 4.0 && < 5.0, distributive >=0.2.2 && < 1.0,- process >= 1.1 && < 1.3,+ process >= 1.1 && < 1.5, fsnotify >= 0.2.1 && < 0.3, directory >= 1.2 && < 1.3, unordered-containers >= 0.2 && < 0.3, text >= 0.7.1 && < 1.3, mtl >= 2.0 && < 2.3,- transformers >= 0.3.0 && < 0.5.0,+ transformers >= 0.3.0 && < 0.6.0, exceptions >= 0.6 && < 1.0 if impl(ghc < 7.6) Build-depends: ghc-prim@@ -146,7 +146,7 @@ main-is: Test.hs other-modules: Diagrams.TwoD.OffsetTest hs-source-dirs: test- build-depends: base >= 4.2 && < 4.9,+ build-depends: base >= 4.2 && < 4.10, tasty >= 0.10, tasty-hunit >= 0.9.2, diagrams-lib
src/Diagrams/Align.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE ConstrainedClassMethods #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE UndecidableInstances #-}
src/Diagrams/Animation.hs view
@@ -93,7 +93,7 @@ -- -- See also 'animRect' for help constructing a background to go -- behind an animation.-animEnvelope :: (Backend b v n, OrderedField n, Metric v, Monoid' m)+animEnvelope :: (OrderedField n, Metric v, Monoid' m) => QAnimation b v n m -> QAnimation b v n m animEnvelope = animEnvelope' 30 @@ -101,7 +101,7 @@ -- parameter is the number of samples per time unit to use. Lower -- rates will be faster but less accurate; higher rates are more -- accurate but slower.-animEnvelope' :: (Backend b v n, OrderedField n, Metric v, Monoid' m)+animEnvelope' :: (OrderedField n, Metric v, Monoid' m) => Rational -> QAnimation b v n m -> QAnimation b v n m animEnvelope' r a = withEnvelope (simulate r a) <$> a @@ -112,7 +112,7 @@ -- -- Uses 30 samples per time unit by default; to adjust this number -- see 'animRect''.-animRect :: (InSpace V2 n t, Num n, Monoid' m, TrailLike t, Enveloped t, Transformable t, Monoid t)+animRect :: (InSpace V2 n t, Monoid' m, TrailLike t, Enveloped t, Transformable t, Monoid t) => QAnimation b V2 n m -> t animRect = animRect' 30 @@ -120,7 +120,7 @@ -- parameter is the number of samples per time unit to use. Lower -- rates will be faster but less accurate; higher rates are more -- accurate but slower.-animRect' :: (InSpace V2 n t, Num n, Monoid' m, TrailLike t, Enveloped t, Transformable t, Monoid t)+animRect' :: (InSpace V2 n t, Monoid' m, TrailLike t, Enveloped t, Transformable t, Monoid t) => Rational -> QAnimation b V2 n m -> t animRect' r anim | null results = rect 1 1
src/Diagrams/Attributes.hs view
@@ -129,10 +129,10 @@ newtype LineWidth n = LineWidth (Last n) deriving (Typeable, Semigroup) -_LineWidth :: (Typeable n, OrderedField n) => Iso' (LineWidth n) n+_LineWidth :: Iso' (LineWidth n) n _LineWidth = iso getLineWidth (LineWidth . Last) -_LineWidthM :: (Typeable n, OrderedField n) => Iso' (LineWidthM n) (Measure n)+_LineWidthM :: Iso' (LineWidthM n) (Measure n) _LineWidthM = mapping _LineWidth instance Typeable n => AttributeClass (LineWidth n)@@ -166,7 +166,7 @@ lwN = lw . normalized -- | A convenient synonym for 'lineWidth (output w)'.-lwO :: (N a ~ n, HasStyle a, Typeable n, Num n) => n -> a -> a+lwO :: (N a ~ n, HasStyle a, Typeable n) => n -> a -> a lwO = lw . output -- | A convenient sysnonym for 'lineWidth (local w)'.@@ -181,7 +181,7 @@ -- | Lens onto the unmeasured linewith attribute. This is useful for -- backends to use on styles once they have been unmeasured. Using on -- a diagram style could lead to unexpected results.-_lineWidthU :: (Typeable n, OrderedField n) => Lens' (Style v n) (Maybe n)+_lineWidthU :: Typeable n => Lens' (Style v n) (Maybe n) _lineWidthU = atAttr . mapping _LineWidth ------------------------------------------------------------------------@@ -219,7 +219,7 @@ dashingN w v = dashing (map normalized w) (normalized v) -- | A convenient synonym for 'dashing (output w)'.-dashingO :: (N a ~ n, HasStyle a, Typeable n, Num n) => [n] -> n -> a -> a+dashingO :: (N a ~ n, HasStyle a, Typeable n) => [n] -> n -> a -> a dashingO w v = dashing (map output w) (output v) -- | A convenient sysnonym for 'dashing (local w)'.@@ -227,14 +227,14 @@ dashingL w v = dashing (map local w) (local v) -- | Lens onto a measured dashing attribute in a style.-_dashing :: (Typeable n, OrderedField n)+_dashing :: Typeable n => Lens' (Style v n) (Maybe (Measured n (Dashing n))) _dashing = atMAttr -- | Lens onto the unmeasured 'Dashing' attribute. This is useful for -- backends to use on styles once they have been unmeasured. Using on -- a diagram style could lead to unexpected results.-_dashingU :: (Typeable n, OrderedField n) => Lens' (Style v n) (Maybe (Dashing n))+_dashingU :: Typeable n => Lens' (Style v n) (Maybe (Dashing n)) _dashingU = atAttr ------------------------------------------------------------------------
src/Diagrams/Backend/CmdLine.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE ConstrainedClassMethods #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-}@@ -462,7 +463,7 @@ -- | This instance allows functions resulting in something that is 'Mainable' to -- be 'Mainable'. It takes a parse of collected arguments and applies them to -- the given function producing the 'Mainable' result.-instance (Parseable (Args (a -> d)), ToResult d, Mainable (ResultOf d))+instance (ToResult d, Mainable (ResultOf d)) => Mainable (a -> d) where type MainOpts (a -> d) = (MainOpts (ResultOf (a -> d)), Args (a -> d))
src/Diagrams/BoundingBox.hs view
@@ -113,7 +113,7 @@ mapT :: (a -> b) -> (a, a) -> (b, b) mapT f (x, y) = (f x, f y) -instance (Additive v, Num n, Ord n) => HasOrigin (BoundingBox v n) where+instance (Additive v, Num n) => HasOrigin (BoundingBox v n) where moveOriginTo p b = fromMaybeEmpty (NonEmptyBoundingBox . mapT (moveOriginTo p) <$> getCorners b)@@ -179,7 +179,7 @@ fromPoints = mconcat . map fromPoint -- | Create a bounding box for any enveloped object (such as a diagram or path).-boundingBox :: (InSpace v n a, HasBasis v, Num n, Enveloped a)+boundingBox :: (InSpace v n a, HasBasis v, Enveloped a) => a -> BoundingBox v n boundingBox a = fromMaybeEmpty $ do env <- (appEnvelope . getEnvelope) a@@ -197,7 +197,7 @@ getCorners (BoundingBox p) = nonEmptyCorners <$> getOption p -- | Computes all of the corners of the bounding box.-getAllCorners :: (Additive v, Traversable v, Num n) => BoundingBox v n -> [Point v n]+getAllCorners :: (Additive v, Traversable v) => BoundingBox v n -> [Point v n] getAllCorners (BoundingBox (Option Nothing)) = [] getAllCorners (BoundingBox (Option (Just (NonEmptyBoundingBox (l, u))))) = T.sequence (liftI2 (\a b -> [a,b]) l u)@@ -213,13 +213,13 @@ -- | Get the center of a the bounding box of an enveloped object, return -- 'Nothing' for object with empty envelope.-mCenterPoint :: (InSpace v n a, HasBasis v, Num n, Enveloped a)+mCenterPoint :: (InSpace v n a, HasBasis v, Enveloped a) => a -> Maybe (Point v n) mCenterPoint = boxCenter . boundingBox -- | Get the center of a the bounding box of an enveloped object, return -- the origin for object with empty envelope.-centerPoint :: (InSpace v n a, HasBasis v, Num n, Enveloped a)+centerPoint :: (InSpace v n a, HasBasis v, Enveloped a) => a -> Point v n centerPoint = fromMaybe origin . mCenterPoint @@ -238,7 +238,7 @@ -- | Transforms an enveloped thing to fit within a @BoundingBox@. If the -- bounding box is empty, then the result is also @mempty@. boxFit- :: (InSpace v n a, HasBasis v, Enveloped a, Transformable a, Monoid a, Num n)+ :: (InSpace v n a, HasBasis v, Enveloped a, Transformable a, Monoid a) => BoundingBox v n -> a -> a boxFit b x = maybe mempty (`transform` x) $ boxTransform (boundingBox x) b
src/Diagrams/Combinators.hs view
@@ -73,7 +73,7 @@ -- > ) -- > c = circle 0.8 -- > withEnvelopeEx = sqNewEnv # centerXY # pad 1.5-withEnvelope :: (InSpace v n a, Metric v, OrderedField n, Monoid' m, Enveloped a)+withEnvelope :: (InSpace v n a, Monoid' m, Enveloped a) => a -> QDiagram b v n m -> QDiagram b v n m withEnvelope = setEnvelope . getEnvelope @@ -117,7 +117,7 @@ -- <<diagrams/src_Diagrams_Combinators_strutEx.svg#diagram=strutEx&width=300>> -- -- > strutEx = (circle 1 ||| strut unitX ||| circle 1) # centerXY # pad 1.1-strut :: (Metric v, OrderedField n, Monoid' m)+strut :: (Metric v, OrderedField n) => v n -> QDiagram b v n m strut v = QD $ D.leafU (inj . toDeletable $ env) where env = translate ((-0.5) *^ v) . getEnvelope $ straight v
src/Diagrams/Deform.hs view
@@ -92,7 +92,7 @@ -- where -- (s1, s2) = splitAtParam s 0.5 -approx :: (Metric v, OrderedField n) => Deformation v u n -> FixedSegment v n -> FixedSegment u n+approx :: Deformation v u n -> FixedSegment v n -> FixedSegment u n approx t (FLinear p0 p1) = FLinear (deform t p0) (deform t p1) approx t (FCubic p0 c1 c2 p1) = FCubic (f p0) (f c1) (f c2) (f p1) where f = deform t
src/Diagrams/LinearMap.hs view
@@ -79,7 +79,7 @@ -- so ghc knows there's only one possible result from calling vmap. -- | Apply a linear map.-linmap :: (InSpace v n a, F.Foldable v, LinearMappable a b, N b ~ n)+linmap :: (InSpace v n a, LinearMappable a b, N b ~ n) => LinearMap v (V b) n -> a -> b linmap = vmap . lapply @@ -137,8 +137,7 @@ mkAffineMap :: (v n -> u n) -> u n -> AffineMap v u n mkAffineMap f = AffineMap (LinearMap f) -toAffineMap :: (HasBasis v, Num n)- => Transformation v n -> AffineMap v v n+toAffineMap :: Transformation v n -> AffineMap v v n toAffineMap t = AffineMap (toLinearMap t) (transl t) class (LinearMappable a b, N a ~ N b) => AffineMappable a b where@@ -155,7 +154,7 @@ instance (Metric v, Metric u, OrderedField n, r ~ Trail' l u n) => AffineMappable (Trail' l v n) r instance (Metric v, Metric u, OrderedField n, r ~ Trail u n) => AffineMappable (Trail v n) r -instance (Additive v, F.Foldable v, Num n, r ~ Point u n) => AffineMappable (Point v n) r where+instance (Additive v, Num n, r ~ Point u n) => AffineMappable (Point v n) r where amap (AffineMap f v) p = linmap f p .+^ v {-# INLINE amap #-}
src/Diagrams/Parametric/Adjust.hs view
@@ -81,7 +81,7 @@ -- | Adjust the length of a parametric object such as a segment or -- trail. The second parameter is an option record which controls how -- the adjustment should be performed; see 'AdjustOpts'.-adjust :: (V t ~ v, N t ~ n, DomainBounds t, Sectionable t, HasArcLength t, Fractional n)+adjust :: (N t ~ n, Sectionable t, HasArcLength t, Fractional n) => t -> AdjustOpts n -> t adjust s opts = section s (if opts^.adjSide == End then domainLower s else getParam s)
src/Diagrams/Path.hs view
@@ -284,7 +284,7 @@ -- | \"Explode\" a path by exploding every component trail (see -- 'explodeTrail').-explodePath :: (V t ~ v, N t ~ n, Additive v, TrailLike t) => Path v n -> [[t]]+explodePath :: (V t ~ v, N t ~ n, TrailLike t) => Path v n -> [[t]] explodePath = map explodeTrail . op Path -- | Partition a path into two paths based on a predicate on trails:
src/Diagrams/Prelude.hs view
@@ -1,4 +1,5 @@ {-# OPTIONS_GHC -fno-warn-duplicate-exports #-}+{-# LANGUAGE CPP #-} ----------------------------------------------------------------------------- -- | -- Module : Diagrams.Prelude@@ -78,11 +79,20 @@ import Diagrams import Control.Applicative++#if MIN_VERSION_lens(4,13,0) import Control.Lens hiding (argument, at, backwards, beside,+ children, contains, indexed, indices,+ inside, levels, none, outside, singular,+ transform, ( # ), (...), (.>), (<.>))+#else+import Control.Lens hiding (argument, at, backwards, beside, children, coerce, contains, indexed, indices, inside, levels, none, outside, singular, transform, ( # ), (...), (.>), (<.>))+#endif+ import Data.Active import Data.Colour hiding (AffineSpace (..), atop, over) import Data.Colour.Names hiding (tan)@@ -93,4 +103,3 @@ import Linear.Affine import Linear.Metric import Linear.Vector-
src/Diagrams/Size.hs view
@@ -98,7 +98,7 @@ mkSizeSpec = dims . fmap (fromMaybe 0) -- | Make a 'SizeSpec' from a vector. Any negative values will be ignored.-dims :: Functor v => v n -> SizeSpec v n+dims :: v n -> SizeSpec v n dims = SizeSpec -- | A size spec with no hints to the size.@@ -135,15 +135,15 @@ -- | Uniformly scale any enveloped object so that it fits within the -- given size. For non-uniform scaling see 'boxFit'.-sized :: (InSpace v n a, HasLinearMap v, HasBasis v, Transformable a, Enveloped a, Fractional n, Ord n)+sized :: (InSpace v n a, HasLinearMap v, Transformable a, Enveloped a) => SizeSpec v n -> a -> a sized spec a = transform (requiredScaling spec (size a)) a -- | Uniformly scale an enveloped object so that it \"has the same -- size as\" (fits within the width and height of) some other -- object.-sizedAs :: (InSpace v n a, SameSpace a b, HasLinearMap v, HasBasis v, Transformable a,- Enveloped a, Enveloped b, Fractional n, Ord n)+sizedAs :: (InSpace v n a, SameSpace a b, HasLinearMap v, Transformable a,+ Enveloped a, Enveloped b) => b -> a -> a sizedAs other = sized (dims $ size other)
src/Diagrams/ThreeD/Align.hs view
@@ -46,8 +46,6 @@ import Diagrams.ThreeD.Vector import Diagrams.TwoD.Align -import Linear.Vector- -- | Translate the diagram along unitX so that all points have -- positive x-values. alignXMin :: (InSpace v n a, R1 v, Fractional n, Alignable a, HasOrigin a) => a -> a@@ -106,7 +104,7 @@ -- | See the documentation for 'alignZ'. snugZ :: (V a ~ v, N a ~ n, Alignable a, Traced a, HasOrigin a,- R3 v, Additive v, Fractional n) => n -> a -> a+ R3 v, Fractional n) => n -> a -> a snugZ = snugBy unitZ @@ -138,4 +136,3 @@ snugCenterXYZ :: (InSpace v n a, R3 v, Fractional n, Alignable a, HasOrigin a, Traced a) => a -> a snugCenterXYZ = snugCenterX . snugCenterY . snugCenterZ-
src/Diagrams/ThreeD/Camera.hs view
@@ -141,10 +141,10 @@ -- aspect ratio of 4:3, for VGA and similar computer resolutions. mm50Narrow = PerspectiveLens (36 @@ deg) (27 @@ deg) -camForward :: Fractional n => Camera l n -> Direction V3 n+camForward :: Camera l n -> Direction V3 n camForward = direction . forward -camUp :: Fractional n => Camera l n -> Direction V3 n+camUp :: Camera l n -> Direction V3 n camUp = direction . up camRight :: Fractional n => Camera l n -> Direction V3 n@@ -156,4 +156,3 @@ camAspect :: (Floating n, CameraLens l) => Camera l n -> n camAspect = aspect . camLens-
src/Diagrams/ThreeD/Light.hs view
@@ -44,7 +44,7 @@ instance Fractional n => Transformable (PointLight n) where transform t (PointLight p c) = PointLight (transform t p) c -instance Fractional n => Transformable (ParallelLight n) where+instance Transformable (ParallelLight n) where transform t (ParallelLight v c) = ParallelLight (transform t v) c -- | Construct a Diagram with a single PointLight at the origin, which
src/Diagrams/Trail.hs view
@@ -140,9 +140,7 @@ type instance V (FingerTree m a) = V a type instance N (FingerTree m a) = N a -instance ( Metric (V a), OrderedField (N a)- , FT.Measured m a, Transformable a- )+instance (FT.Measured m a, Transformable a) => Transformable (FingerTree m a) where transform = FT.fmap' . transform @@ -307,18 +305,14 @@ -- extract the given measure for a trail and use it to compute a -- result. Put another way, lift a function on a single measure -- (along with a default value) to a function on an entire trail.-trailMeasure :: ( Metric v, OrderedField n- , SegMeasure v n :>: m, FT.Measured (SegMeasure v n) t- )+trailMeasure :: ( SegMeasure v n :>: m, FT.Measured (SegMeasure v n) t ) => a -> (m -> a) -> t -> a trailMeasure d f = option d f . get . FT.measure -- | Compute the number of segments of anything measured by -- 'SegMeasure' (/e.g./ @SegMeasure@ itself, @Segment@, @SegTree@, -- @Trail@s...)-numSegs :: ( OrderedField n, Num c, Metric v,- FT.Measured (SegMeasure v n) a- )+numSegs :: (Num c, FT.Measured (SegMeasure v n) a) => a -> c numSegs = fromIntegral . trailMeasure 0 (getSum . op SegCount) @@ -634,7 +628,7 @@ domainLower (GetSegment t) = domainLower t domainUpper (GetSegment t) = domainUpper t -instance (Metric v, OrderedField n, Real n)+instance (Metric v, OrderedField n) => EndValues (GetSegment (Trail' Line v n)) where atStart (GetSegment (Line (SegTree ft))) = case FT.viewl ft of@@ -1074,7 +1068,7 @@ trailOffset = withLine lineOffset -- | Extract the offsets of the segments of a line.-lineOffsets :: (Metric v, OrderedField n) => Trail' Line v n -> [v n]+lineOffsets :: Trail' Line v n -> [v n] lineOffsets = map segOffset . lineSegments -- | Extract the offsets of the segments of a loop.
src/Diagrams/TrailLike.hs view
@@ -197,8 +197,7 @@ -- > # explodeTrail -- generate a list of diagrams -- > # zipWith lc [orange, green, yellow, red, blue] -- > # mconcat # centerXY # pad 1.1-explodeTrail :: (V t ~ v, N t ~ n, Additive v, TrailLike t) => Located (Trail v n) -> [t]+explodeTrail :: (V t ~ v, N t ~ n, TrailLike t) => Located (Trail v n) -> [t] explodeTrail = map (mkTrail . fromFixedSeg) . fixTrail where mkTrail = trailLike . mapLoc (trailFromSegments . (:[]))-
src/Diagrams/Transform.hs view
@@ -43,7 +43,7 @@ -- | Conjugate one transformation by another. @conjugate t1 t2@ is the -- transformation which performs first @t1@, then @t2@, then the -- inverse of @t1@.-conjugate :: (Additive v, Num n, Functor v)+conjugate :: (Additive v, Num n) => Transformation v n -> Transformation v n -> Transformation v n conjugate t1 t2 = inv t1 <> t2 <> t1
src/Diagrams/Transform/Matrix.hs view
@@ -13,9 +13,6 @@ module Diagrams.Transform.Matrix where -#if __GLASGOW_HASKELL__ < 710-import Control.Applicative-#endif import Control.Arrow ((&&&)) import Control.Lens import Data.Distributive
src/Diagrams/Transform/ScaleInv.hs view
@@ -183,6 +183,6 @@ -- scale-invariant things will be used only as \"decorations\" (/e.g./ -- arrowheads) which should not affect the envelope, trace, and -- query.-scaleInvPrim :: (V t ~ V2, N t ~ n, RealFloat n, Transformable t, Typeable t, Renderable t b, Monoid m)+scaleInvPrim :: (V t ~ V2, N t ~ n, RealFloat n, Typeable t, Renderable t b, Monoid m) => t -> V2 n -> QDiagram b (V t) (N t) m scaleInvPrim t d = mkQD (Prim $ scaleInv t d) mempty mempty mempty mempty
src/Diagrams/TwoD/Arrow.hs view
@@ -253,7 +253,7 @@ -- default style after all other styles have been applied. -- The semigroup stucture of the lw attribute will insure that the default -- is only used if it has not been set in @opts@.-shaftSty :: Fractional n => ArrowOpts n -> Style V2 n+shaftSty :: ArrowOpts n -> Style V2 n shaftSty opts = opts^.shaftStyle -- Set the default head style. See `shaftSty`.
src/Diagrams/TwoD/Arrowheads.hs view
@@ -197,7 +197,7 @@ sz = max 1 ((len - jLength) / 1.5) -- | Make a side for the thorn head.-curvedSide :: (Floating n, Ord n) => Angle n -> Segment Closed V2 n+curvedSide :: Floating n => Angle n -> Segment Closed V2 n curvedSide theta = bezier3 ctrl1 ctrl2 end where v0 = unit_X@@ -211,7 +211,7 @@ lineHead :: RealFloat n => ArrowHT n lineHead s w = (square 1 # scaleX s # scaleY w # alignL, mempty) -noHead :: (Floating n, Ord n) => ArrowHT n+noHead :: ArrowHT n noHead _ _ = (mempty, mempty) -- | <<diagrams/src_Diagrams_TwoD_Arrowheads_triEx.svg#diagram=triEx&width=100>>@@ -299,7 +299,7 @@ lineTail :: RealFloat n => ArrowHT n lineTail s w = (square 1 # scaleY w # scaleX s # alignR, mempty) -noTail :: OrderedField n => ArrowHT n+noTail :: ArrowHT n noTail _ _ = (mempty, mempty) -- | <<diagrams/src_Diagrams_TwoD_Arrowheads_tri'Ex.svg#diagram=tri'Ex&width=100>>
src/Diagrams/TwoD/Attributes.hs view
@@ -420,11 +420,5 @@ -- to loops. splitTextureFills :: forall b v n a. (-#if __GLASGOW_HASKELL__ > 707- Typeable v-#else- Typeable1 v-#endif-- , Typeable n) => RTree b v n a -> RTree b v n a+ Typeable n) => RTree b v n a -> RTree b v n a splitTextureFills = splitAttr (FillTextureLoops :: FillTextureLoops n)
src/Diagrams/TwoD/Combinators.hs view
@@ -80,7 +80,7 @@ -- combined diagram is the same as the local origin of the first. -- @(===)@ is associative and has 'mempty' as an identity. See the -- documentation of 'beside' for more information.-(===) :: (InSpace V2 n a, Num n, Juxtaposable a, Semigroup a) => a -> a -> a+(===) :: (InSpace V2 n a, Juxtaposable a, Semigroup a) => a -> a -> a (===) = beside unit_Y -- | Place two diagrams (or other juxtaposable objects) horizontally@@ -89,7 +89,7 @@ -- is the same as the local origin of the first. @(|||)@ is -- associative and has 'mempty' as an identity. See the -- documentation of 'beside' for more information.-(|||) :: (InSpace V2 n a, Num n, Juxtaposable a, Semigroup a) => a -> a -> a+(|||) :: (InSpace V2 n a, Juxtaposable a, Semigroup a) => a -> a -> a (|||) = beside unitX -- | Lay out a list of juxtaposable objects in a row from left to right,@@ -164,13 +164,13 @@ -- | @strutX w@ is an empty diagram with width @w@, height 0, and a -- centered local origin. Note that @strutX (-w)@ behaves the same as -- @strutX w@.-strutX :: (Metric v, R1 v, OrderedField n, Monoid' m) => n -> QDiagram b v n m+strutX :: (Metric v, R1 v, OrderedField n) => n -> QDiagram b v n m strutX d = strut (zero & _x .~ d) -- | @strutY h@ is an empty diagram with height @h@, width 0, and a -- centered local origin. Note that @strutY (-h)@ behaves the same as -- @strutY h@.-strutY :: (Metric v, R2 v, OrderedField n, Monoid' m) => n -> QDiagram b v n m+strutY :: (Metric v, R2 v, OrderedField n) => n -> QDiagram b v n m strutY d = strut (zero & _y .~ d) -- | @padX s@ \"pads\" a diagram in the x-direction, expanding its@@ -263,4 +263,3 @@ bgFrame :: (TypeableFloat n, Renderable (Path V2 n) b) => n -> Colour Double -> QDiagram b V2 n Any -> QDiagram b V2 n Any bgFrame f c d = d <> boundingRect (frame f d) # lwO 0 # fc c-
src/Diagrams/TwoD/Ellipse.hs view
@@ -35,18 +35,18 @@ import Diagrams.Util -- | A circle of radius 1, with center at the origin.-unitCircle :: (TrailLike t, V t ~ V2, N t ~ n, RealFloat n) => t+unitCircle :: (TrailLike t, V t ~ V2, N t ~ n) => t unitCircle = trailLike $ glueTrail (arcT xDir fullTurn) `at` p2 (1,0) -- | A circle of the given radius, centered at the origin. As a path, -- it begins at (r,0).-circle :: (TrailLike t, V t ~ V2, N t ~ n, RealFloat n, Transformable t) => n -> t+circle :: (TrailLike t, V t ~ V2, N t ~ n, Transformable t) => n -> t circle d = unitCircle # scale d -- | @ellipse e@ constructs an ellipse with eccentricity @e@ by -- scaling the unit circle in the X direction. The eccentricity must -- be within the interval [0,1).-ellipse :: (TrailLike t, V t ~ V2, N t ~ n, RealFloat n, Transformable t) => n -> t+ellipse :: (TrailLike t, V t ~ V2, N t ~ n, Transformable t) => n -> t ellipse e | e >= 0 && e < 1 = scaleX (sqrt (1 - e*e)) unitCircle | otherwise = error "Eccentricity of ellipse must be >= 0 and < 1."@@ -54,5 +54,5 @@ -- | @ellipseXY x y@ creates an axis-aligned ellipse, centered at the -- origin, with radius @x@ along the x-axis and radius @y@ along the -- y-axis.-ellipseXY :: (TrailLike t, V t ~ V2, N t ~ n, RealFloat n, Transformable t) => n -> n -> t+ellipseXY :: (TrailLike t, V t ~ V2, N t ~ n, Transformable t) => n -> n -> t ellipseXY x y = unitCircle # scaleX x # scaleY y
src/Diagrams/TwoD/Offset.hs view
@@ -337,7 +337,7 @@ -- > where -- > c = hexagon 5 -withTrailL :: (OrderedField n) => (Located (Trail' Line V2 n) -> r) -> (Located (Trail' Loop V2 n) -> r) -> Located (Trail V2 n) -> r+withTrailL :: (Located (Trail' Line V2 n) -> r) -> (Located (Trail' Loop V2 n) -> r) -> Located (Trail V2 n) -> r withTrailL f g l = withTrail (f . (`at` p)) (g . (`at` p)) (unLoc l) where p = loc l
src/Diagrams/TwoD/Path.hs view
@@ -404,7 +404,7 @@ -- trace consists of those parts of the original diagram's trace -- which fall within the clipping path, or parts of the path's trace -- within the original diagram.-clipTo :: (TypeableFloat n, Renderable (Path V2 n) b)+clipTo :: TypeableFloat n => Path V2 n -> QDiagram b V2 n Any -> QDiagram b V2 n Any clipTo p d = setTrace intersectionTrace . toEnvelope $ clipBy p d where@@ -425,7 +425,7 @@ -- | Clip a diagram to the clip path taking the envelope and trace of the clip -- path.-clipped :: (TypeableFloat n, Renderable (Path V2 n) b)+clipped :: TypeableFloat n => Path V2 n -> QDiagram b V2 n Any -> QDiagram b V2 n Any clipped p = withTrace p . withEnvelope p . clipBy p
src/Diagrams/TwoD/Polygons.hs view
@@ -180,7 +180,7 @@ NoOrient -> mempty -- | Generate the polygon described by the given options.-polygon :: (InSpace V2 n t, TrailLike t, OrderedField n) => PolygonOpts n -> t+polygon :: (InSpace V2 n t, TrailLike t) => PolygonOpts n -> t polygon = trailLike . polyTrail -- | Generate the located trail of a polygon specified by polar data
src/Diagrams/TwoD/Shapes.hs view
@@ -87,7 +87,7 @@ -- oriented parallel to the axes. -- -- <<diagrams/src_Diagrams_TwoD_Shapes_unitSquareEx.svg#diagram=unitSquareEx&width=100>>-unitSquare :: (InSpace V2 n t, TrailLike t, OrderedField n) => t+unitSquare :: (InSpace V2 n t, TrailLike t) => t unitSquare = polygon (def & polyType .~ PolyRegular 4 (sqrt 2 / 2) & polyOrient .~ OrientH) @@ -97,7 +97,7 @@ -- length, oriented parallel to the axes. -- -- <<diagrams/src_Diagrams_TwoD_Shapes_squareEx.svg#diagram=squareEx&width=200>>-square :: (InSpace V2 n t, TrailLike t, OrderedField n) => n -> t+square :: (InSpace V2 n t, TrailLike t) => n -> t square d = rect d d -- > squareEx = hcat' (with & sep .~ 0.5) [square 1, square 2, square 3]@@ -107,7 +107,7 @@ -- @h@, centered at the origin. -- -- <<diagrams/src_Diagrams_TwoD_Shapes_rectEx.svg#diagram=rectEx&width=150>>-rect :: (InSpace V2 n t, TrailLike t, OrderedField n) => n -> n -> t+rect :: (InSpace V2 n t, TrailLike t) => n -> n -> t rect w h = trailLike . head . op Path $ unitSquare # scaleX w # scaleY h -- > rectEx = rect 1 0.7 # pad 1.1@@ -139,7 +139,7 @@ -- polygons of a given /radius/). -- -- The polygon will be oriented with one edge parallel to the x-axis.-regPoly :: (InSpace V2 n t, TrailLike t, OrderedField n) => Int -> n -> t+regPoly :: (InSpace V2 n t, TrailLike t) => Int -> n -> t regPoly n l = polygon (def & polyType .~ PolySides (repeat (1/fromIntegral n @@ turn))@@ -159,76 +159,76 @@ -- > dodecagonEx = shapeEx dodecagon -- | A synonym for 'triangle', provided for backwards compatibility.-eqTriangle :: (InSpace V2 n t, TrailLike t, OrderedField n) => n -> t+eqTriangle :: (InSpace V2 n t, TrailLike t) => n -> t eqTriangle = triangle -- | An equilateral triangle, with sides of the given length and base -- parallel to the x-axis. -- -- <<diagrams/src_Diagrams_TwoD_Shapes_triangleEx.svg#diagram=triangleEx&width=100>>-triangle :: (InSpace V2 n t, TrailLike t, OrderedField n) => n -> t+triangle :: (InSpace V2 n t, TrailLike t) => n -> t triangle = regPoly 3 -- | A regular pentagon, with sides of the given length and base -- parallel to the x-axis. -- -- <<diagrams/src_Diagrams_TwoD_Shapes_pentagonEx.svg#diagram=pentagonEx&width=100>>-pentagon :: (InSpace V2 n t, TrailLike t, OrderedField n) => n -> t+pentagon :: (InSpace V2 n t, TrailLike t) => n -> t pentagon = regPoly 5 -- | A regular hexagon, with sides of the given length and base -- parallel to the x-axis. -- -- <<diagrams/src_Diagrams_TwoD_Shapes_hexagonEx.svg#diagram=hexagonEx&width=100>>-hexagon :: (InSpace V2 n t, TrailLike t, OrderedField n) => n -> t+hexagon :: (InSpace V2 n t, TrailLike t) => n -> t hexagon = regPoly 6 -- | A regular heptagon, with sides of the given length and base -- parallel to the x-axis. -- -- <<diagrams/src_Diagrams_TwoD_Shapes_heptagonEx.svg#diagram=heptagonEx&width=100>>-heptagon :: (InSpace V2 n t, TrailLike t, OrderedField n) => n -> t+heptagon :: (InSpace V2 n t, TrailLike t) => n -> t heptagon = regPoly 7 -- | A synonym for 'heptagon'. It is, however, completely inferior, -- being a base admixture of the Latin /septum/ (seven) and the -- Greek γωνία (angle).-septagon :: (InSpace V2 n t, TrailLike t, OrderedField n) => n -> t+septagon :: (InSpace V2 n t, TrailLike t) => n -> t septagon = heptagon -- | A regular octagon, with sides of the given length and base -- parallel to the x-axis. -- -- <<diagrams/src_Diagrams_TwoD_Shapes_octagonEx.svg#diagram=octagonEx&width=100>>-octagon :: (InSpace V2 n t, TrailLike t, OrderedField n) => n -> t+octagon :: (InSpace V2 n t, TrailLike t) => n -> t octagon = regPoly 8 -- | A regular nonagon, with sides of the given length and base -- parallel to the x-axis. -- -- <<diagrams/src_Diagrams_TwoD_Shapes_nonagonEx.svg#diagram=nonagonEx&width=100>>-nonagon :: (InSpace V2 n t, TrailLike t, OrderedField n) => n -> t+nonagon :: (InSpace V2 n t, TrailLike t) => n -> t nonagon = regPoly 9 -- | A regular decagon, with sides of the given length and base -- parallel to the x-axis. -- -- <<diagrams/src_Diagrams_TwoD_Shapes_decagonEx.svg#diagram=decagonEx&width=100>>-decagon :: (InSpace V2 n t, TrailLike t, OrderedField n) => n -> t+decagon :: (InSpace V2 n t, TrailLike t) => n -> t decagon = regPoly 10 -- | A regular hendecagon, with sides of the given length and base -- parallel to the x-axis. -- -- <<diagrams/src_Diagrams_TwoD_Shapes_hendecagonEx.svg#diagram=hendecagonEx&width=100>>-hendecagon :: (InSpace V2 n t, TrailLike t, OrderedField n) => n -> t+hendecagon :: (InSpace V2 n t, TrailLike t) => n -> t hendecagon = regPoly 11 -- | A regular dodecagon, with sides of the given length and base -- parallel to the x-axis. -- -- <<diagrams/src_Diagrams_TwoD_Shapes_dodecagonEx.svg#diagram=dodecagonEx&width=100>>-dodecagon :: (InSpace V2 n t, TrailLike t, OrderedField n) => n -> t+dodecagon :: (InSpace V2 n t, TrailLike t) => n -> t dodecagon = regPoly 12 ------------------------------------------------------------
src/Diagrams/TwoD/Text.hs view
@@ -193,7 +193,7 @@ font = applyAttr . Font . Last -- | Lens onto the font name of a style.-_font :: (Typeable n, OrderedField n) => Lens' (Style v n) (Maybe String)+_font :: Lens' (Style v n) (Maybe String) _font = atAttr . mapping _Font --------------------------------------------------@@ -248,7 +248,7 @@ fontSizeN = fontSize . normalized -- | A convenient synonym for 'fontSize (Output w)'.-fontSizeO :: (N a ~ n, Typeable n, Num n, HasStyle a) => n -> a -> a+fontSizeO :: (N a ~ n, Typeable n, HasStyle a) => n -> a -> a fontSizeO = fontSize . output -- | A convenient sysnonym for 'fontSize (Local w)'.@@ -256,7 +256,7 @@ fontSizeL = fontSize . local -- | Apply a 'FontSize' attribute.-fontSizeM :: (N a ~ n, Typeable n, Num n, HasStyle a) => FontSizeM n -> a -> a+fontSizeM :: (N a ~ n, Typeable n, HasStyle a) => FontSizeM n -> a -> a fontSizeM = applyMAttr recommendFontSize :: (N a ~ n, Typeable n, HasStyle a) => Measure n -> a -> a@@ -270,7 +270,7 @@ _fontSize :: (Typeable n, OrderedField n) => Lens' (Style v n) (Measure n) _fontSize = _fontSizeR . mapping committed -_fontSizeU :: (Typeable n, OrderedField n) => Lens' (Style v n) (Maybe n)+_fontSizeU :: (Typeable n) => Lens' (Style v n) (Maybe n) _fontSizeU = atAttr . mapping (_FontSize . committed) --------------------------------------------------@@ -302,7 +302,7 @@ fontSlant = applyAttr -- | Lens onto the font slant in a style.-_fontSlant :: (Typeable n, OrderedField n) => Lens' (Style v n) FontSlant+_fontSlant :: Lens' (Style v n) FontSlant _fontSlant = atAttr . non def -- | Set all text in italics.@@ -347,5 +347,5 @@ bold = fontWeight FontWeightBold -- | Lens onto the font weight in a style.-_fontWeight :: (Typeable n, OrderedField n) => Lens' (Style v n) FontWeight+_fontWeight :: Lens' (Style v n) FontWeight _fontWeight = atAttr . non def