diagrams-core 1.4.2 → 1.5.1.2
raw patch · 14 files changed
Files
- CHANGELOG.md +58/−0
- README.markdown +1/−1
- diagrams-core.cabal +12/−13
- src/Diagrams/Core.hs +1/−1
- src/Diagrams/Core/Compile.hs +3/−3
- src/Diagrams/Core/Envelope.hs +5/−4
- src/Diagrams/Core/HasOrigin.hs +1/−0
- src/Diagrams/Core/Juxtapose.hs +1/−0
- src/Diagrams/Core/Measure.hs +2/−3
- src/Diagrams/Core/Style.hs +2/−1
- src/Diagrams/Core/Trace.hs +2/−1
- src/Diagrams/Core/Transform.hs +13/−13
- src/Diagrams/Core/Types.hs +6/−5
- src/Diagrams/Core/V.hs +6/−5
CHANGELOG.md view
@@ -1,3 +1,61 @@+## [v1.5.1.2](https://github.com/diagrams/diagrams-core/tree/v1.5.1.2) (2026-04-18)++- Allow `base-4.22`, `containers-0.8`, and test on GHC 9.14+- Fix some pattern match warnings+- Remove `semigroups` dependency++## [v1.5.1.1-r4](https://github.com/diagrams/diagrams-core/tree/v1.5.1.1-r4) (2025-05-16)++- Allow `monoid-extras-0.7`++## [v1.5.1.1-r3](https://github.com/diagrams/diagrams-core/tree/v1.5.1.1-r3) (2025-01-30)++- Allow `base-4.21` (GHC 9.12)++## [v1.5.1.1-r2](https://github.com/diagrams/diagrams-core/tree/v1.5.1.1-r2) (2024-05-20)++- Allow:+ - `base-4.20` (GHC 9.10)+ - `lens-5.3`+ - `containers-0.7`+- Test on GHC 9.10++## [v1.5.1.1-r1](https://github.com/diagrams/diagrams-core/tree/v1.5.1.1-r1) (2024-04-20)++* Allow `linear-1.23`++## [v1.5.1.1](https://github.com/diagrams/diagrams-core/tree/v1.5.1.1) (2023-11-15)++* Allow `base-4.19` and test on GHC 9.8+* Fix more warnings++## [v1.5.1](https://github.com/diagrams/diagrams-core/tree/v1.5.1) (2023-05-11)++* Allow `base-4.18` and test on GHC 9.6 (thanks to @sergv)+* Fix some warnings (thanks to @sergv)+* Fix some documentation typos (thanks to @mchav)++## [v1.5.0.1-r1](https://github.com/diagrams/diagrams-core/tree/v1.5.0.1-r1) (2022-11-30)++* Allow `linear-1.22`++## [v1.5.0.1](https://github.com/diagrams/diagrams-core/tree/v1.5.0.1) (2022-08-27)++* Test with up to `base-4.17` and GHC 9.4+* Allow `lens-5.2`+* Fix documentation for `atLeast` and `atMost` (thanks to Igor Moreno)++## [v1.5.0](https://github.com/diagrams/diagrams-core/tree/v1.5.0) (2021-05-13)++* Updates for GHC 8.10 and 9.0+* Drop support for GHC < 8.4+* Remove deprecated `Option` type in favor of `Maybe`. This is a+ breaking API change.++## [v1.4.2-r1](https://github.com/diagrams/diagrams-core/tree/v1.4.2-r1) (2020-02-10)++* Allow `lens-4.19` and `linear-1.21`+ ## [v1.4.2](https://github.com/diagrams/diagrams-core/tree/v1.4.2) (2019-10-19) * New `KeyVal` constructor for `Annotation` ([PR](https://github.com/diagrams/diagrams-core/pull/104))
README.markdown view
@@ -1,4 +1,4 @@-[](http://travis-ci.org/diagrams/diagrams-core)+[](https://github.com/diagrams/diagrams-core/actions/workflows/haskell-ci.yml) The core modules defining the basic data structures and algorithms for [diagrams](http://projects.haskell.org/diagrams), a Haskell embedded
diagrams-core.cabal view
@@ -1,10 +1,10 @@ Name: diagrams-core-Version: 1.4.2+Version: 1.5.1.2 Synopsis: Core libraries for diagrams EDSL Description: The core modules underlying diagrams, an embedded domain-specific language for compositional, declarative drawing.-Homepage: http://projects.haskell.org/diagrams+Homepage: https://diagrams.github.io License: BSD3 License-file: LICENSE Author: Brent Yorgey@@ -13,12 +13,12 @@ Category: Graphics Build-type: Simple Cabal-version: 1.18-Extra-source-files: CHANGELOG.md, README.markdown, diagrams/*.svg-extra-doc-files: diagrams/*.svg-Tested-with: GHC == 7.10.2, GHC == 8.0.1, GHC == 8.2.2, GHC == 8.4.1, GHC == 8.6.1, GHC == 8.8.1+Extra-source-files: diagrams/*.svg+extra-doc-files: diagrams/*.svg, CHANGELOG.md, README.markdown+Tested-with: GHC ==8.4.4 || ==8.6.5 || ==8.8.4 || ==8.10.7 || ==9.0.2 || ==9.2.8 || ==9.4.8 || ==9.6.6 || ==9.8.2 || ==9.10.1 || ==9.12.1 || ==9.14.1 Source-repository head type: git- location: git://github.com/diagrams/diagrams-core.git+ location: https://github.com/diagrams/diagrams-core.git Library Exposed-modules: Diagrams.Core,@@ -36,18 +36,17 @@ Diagrams.Core.Types, Diagrams.Core.V - Build-depends: base >= 4.2 && < 4.14,- containers >= 0.4.2 && < 0.7,+ Build-depends: base >= 4.11 && < 4.23,+ containers >= 0.4.2 && < 0.9, unordered-containers >= 0.2 && < 0.3,- semigroups >= 0.8.4 && < 0.20,- monoid-extras >= 0.3 && < 0.6,+ monoid-extras >= 0.6 && < 0.8, dual-tree >= 0.2 && < 0.3,- lens >= 4.0 && < 4.19,- linear >= 1.11.3 && < 1.21,+ lens >= 4.0 && < 5.4,+ linear >= 1.11.3 && < 1.24, adjunctions >= 4.0 && < 5.0, distributive >=0.2.2 && < 1.0, profunctors >= 5.0 && < 6.0,- mtl+ mtl >= 2.2 && < 2.4 hs-source-dirs: src Other-extensions: DeriveDataTypeable
src/Diagrams/Core.hs view
@@ -26,7 +26,7 @@ -- -- The best place to start when learning -- about diagrams\' types is the user manual:--- <http://projects.haskell.org/diagrams/doc/manual.html#type-reference>+-- <https://diagrams.github.io/doc/manual.html#type-reference> -- The following list shows which types are contained in each module of -- "Diagrams.Core". --
src/Diagrams/Core/Compile.hs view
@@ -103,8 +103,8 @@ -- 'untangle' we have already performed the action of the -- transform on the style). (\d t -> case get d of- Option Nothing -> t- Option (Just d') ->+ Nothing -> t+ Just d' -> let (tr,sty) = untangle d' in Node (DStyle sty) [Node (DTransform tr) [t]] )@@ -113,7 +113,7 @@ (\a t -> Node (DAnnot a) [t]) qd --- | Convert a @DTree@ to an @RTree@ which can be used dirctly by backends.+-- | Convert a @DTree@ to an @RTree@ which can be used directly by backends. -- A @DTree@ includes nodes of type @DTransform (Transformation v)@; -- in the @RTree@ transform is pushed down until it reaches a primitive node. fromDTree :: forall b v n. (Floating n, HasLinearMap v)
src/Diagrams/Core/Envelope.hs view
@@ -7,6 +7,7 @@ {-# LANGUAGE RankNTypes #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} ----------------------------------------------------------------------------- -- |@@ -109,10 +110,10 @@ -- The idea for envelopes came from -- Sebastian Setzer; see -- <http://byorgey.wordpress.com/2009/10/28/collecting-attributes/#comment-2030>. See also Brent Yorgey, /Monoids: Theme and Variations/, published in the 2012 Haskell Symposium: <http://ozark.hendrix.edu/~yorgey/pub/monoid-pearl.pdf>; video: <http://www.youtube.com/watch?v=X-8NCkD2vOw>.-newtype Envelope v n = Envelope (Option (v n -> Max n))+newtype Envelope v n = Envelope (Maybe (v n -> Max n)) instance Wrapped (Envelope v n) where- type Unwrapped (Envelope v n) = Option (v n -> Max n)+ type Unwrapped (Envelope v n) = Maybe (v n -> Max n) _Wrapped' = iso (\(Envelope e) -> e) Envelope instance Rewrapped (Envelope v n) (Envelope v' n')@@ -120,7 +121,7 @@ -- | \"Apply\" an envelope by turning it into a function. @Nothing@ -- is returned iff the envelope is empty. appEnvelope :: Envelope v n -> Maybe (v n -> n)-appEnvelope (Envelope (Option e)) = (getMax .) <$> e+appEnvelope (Envelope e) = (getMax .) <$> e -- | A convenient way to transform an envelope, by specifying a -- transformation on the underlying @v n -> n@ function. The empty@@ -130,7 +131,7 @@ -- | Create an envelope from a @v n -> n@ function. mkEnvelope :: (v n -> n) -> Envelope v n-mkEnvelope = Envelope . Option . Just . (Max .)+mkEnvelope = Envelope . Just . (Max .) -- | Create a point envelope for the given point. A point envelope -- has distance zero to a bounding hyperplane in every direction.
src/Diagrams/Core/HasOrigin.hs view
@@ -3,6 +3,7 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} -- The UndecidableInstances flag is needed under 6.12.3 for the
src/Diagrams/Core/Juxtapose.hs view
@@ -3,6 +3,7 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} ----------------------------------------------------------------------------- -- |
src/Diagrams/Core/Measure.hs view
@@ -78,11 +78,11 @@ scaleLocal :: Num n => n -> Measured n a -> Measured n a scaleLocal s = R.local (_1 *~ s) --- | Calculate the smaller of two measures.+-- | Calculate the larger of two measures. atLeast :: Ord n => Measure n -> Measure n -> Measure n atLeast = liftA2 max --- | Calculate the larger of two measures.+-- | Calculate the smaller of two measures. atMost :: Ord n => Measure n -> Measure n -> Measure n atMost = liftA2 min @@ -126,7 +126,6 @@ instance Monoid a => Monoid (Measured n a) where mempty = pure mempty- mappend = liftA2 mappend instance Distributive (Measured n) where distribute a = Measured $ \x -> fmap (\(Measured m) -> m x) a
src/Diagrams/Core/Style.hs view
@@ -69,6 +69,7 @@ import Control.Arrow ((***)) import Control.Lens hiding (transform) import qualified Data.HashMap.Strict as HM+import Data.Kind (Type) import qualified Data.Map as M import Data.Monoid.Action as A import Data.Semigroup@@ -111,7 +112,7 @@ -- are simply inert/static; some are affected by transformations; -- and some are affected by transformations and can be modified -- generically.-data Attribute (v :: * -> *) n :: * where+data Attribute (v :: Type -> Type) n :: Type where Attribute :: AttributeClass a => a -> Attribute v n MAttribute :: AttributeClass a => Measured n a -> Attribute v n TAttribute :: (AttributeClass a, Transformable a, V a ~ v, N a ~ n) => a -> Attribute v n
src/Diagrams/Core/Trace.hs view
@@ -1,11 +1,12 @@-{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE CPP #-}+{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} {-# OPTIONS_GHC -fno-warn-unused-imports #-}
src/Diagrams/Core/Transform.hs view
@@ -6,10 +6,9 @@ {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-}-{-# LANGUAGE TypeSynonymInstances #-} {-# LANGUAGE UndecidableInstances #-}-{-# OPTIONS_GHC -fno-warn-unused-imports #-}------------------------------------------------------------------------------+{-# OPTIONS_GHC -fno-warn-unused-imports #-}+ -- | -- Module : Diagrams.Core.Transform -- Copyright : (c) 2011-2015 diagrams-core team (see LICENSE)@@ -232,22 +231,23 @@ -- Remove the nth element from a list remove :: Int -> [a] -> [a]-remove n xs = ys ++ tail zs- where- (ys, zs) = splitAt n xs+remove n xs | n < 0 = xs+remove n xs = ys ++ drop 1 zs+ where+ (ys, zs) = splitAt n xs --- Minor matrix of cofactore C(i,j)+-- Minor matrix of cofactor C(i,j) minor :: Int -> Int -> [[a]] -> [[a]] minor i j xs = remove j $ map (remove i) xs --- The determinant of a square matrix represented as a list of lists+-- The determinant of a square matrix represented as a nonempty list of lists -- representing column vectors, that is [column]. det :: Num a => [[a]] -> a-det (a:[]) = head a-det m = sum [(-1)^i * (c1 !! i) * det (minor i 0 m) | i <- [0 .. (n-1)]]- where- c1 = head m- n = length m+det [] = error "determinant of empty matrix!"+det [a : _] = a+det m@(c1 : _) = sum [(-1) ^ i * (c1 !! i) * det (minor i 0 m) | i <- [0 .. (n - 1)]]+ where+ n = length m -- | Convert a vector v to a list of scalars. listRep :: Foldable v => v n -> [n]
src/Diagrams/Core/Types.hs view
@@ -136,6 +136,7 @@ prism', view, (^.), _Wrapped, _Wrapping) import Control.Monad (mplus)+import Data.Kind (Type) import Data.List (isSuffixOf) import qualified Data.Map as M import Data.Maybe (fromMaybe, listToMaybe)@@ -224,7 +225,7 @@ -- | Extract the (total) transformation from a downwards annotation -- value. transfFromAnnot :: (Additive v, Num n) => DownAnnots v n -> Transformation v n-transfFromAnnot = option mempty killR . fst+transfFromAnnot = maybe mempty killR . fst -- | A leaf in a 'QDiagram' tree is either a 'Prim', or a \"delayed\" -- @QDiagram@ which expands to a real @QDiagram@ once it learns the@@ -347,7 +348,7 @@ -- | A useful variant of 'getU' which projects out a certain -- component. getU' :: (Monoid u', u :>: u') => D.DUALTree d u a l -> u'-getU' = maybe mempty (option mempty id . get) . D.getU+getU' = maybe mempty (maybe mempty id . get) . D.getU -- | Lens onto the 'Envelope' of a 'QDiagram'. envelope :: (OrderedField n, Metric v, Monoid' m)@@ -841,13 +842,13 @@ -- able to convert primitives into this type; how these rendered -- primitives are combined into an ultimate 'Result' is completely -- up to the backend.- data Render b v n :: *+ data Render b v n :: Type -- | The result of running/interpreting a rendering operation.- type Result b v n :: *+ type Result b v n :: Type -- | Backend-specific rendering options.- data Options b v n :: *+ data Options b v n :: Type -- | 'adjustDia' allows the backend to make adjustments to the final -- diagram (e.g. to adjust the size based on the options) before
src/Diagrams/Core/V.hs view
@@ -20,6 +20,7 @@ , InSpace, SameSpace ) where +import Data.Kind (Type) import Data.Map import Data.Monoid.Coproduct import Data.Monoid.Deletable@@ -38,7 +39,7 @@ -- the associated vector space. The resulting vector space has kind @* -> *@ -- which means it takes another value (a number) and returns a concrete -- vector. For example 'V2' has kind @* -> *@ and @V2 Double@ is a vector.-type family V a :: * -> *+type family V a :: Type -> Type -- Note, to use these instances one often needs a constraint of the form -- V a ~ V b, etc.@@ -47,7 +48,7 @@ type instance V (a -> b) = V b type instance V [a] = V a-type instance V (Option a) = V a+type instance V (Maybe a) = V a type instance V (Set a) = V a type instance V (Map k a) = V a @@ -56,14 +57,14 @@ type instance V (m :+: n) = V m -- | The numerical field for the object, the number type used for calculations.-type family N a :: *+type family N a :: Type type instance N (a,b) = N a type instance N (a,b,c) = N a type instance N (a -> b) = N b type instance N [a] = N a-type instance N (Option a) = N a+type instance N (Maybe a) = N a type instance N (Set a) = N a type instance N (Map k a) = N a @@ -71,7 +72,7 @@ type instance N (Split m) = N m type instance N (m :+: n) = N m --- | Conveient type alias to retrieve the vector type associated with an+-- | Convenient type alias to retrieve the vector type associated with an -- object's vector space. This is usually used as @Vn a ~ v n@ where @v@ is -- the vector space and @n@ is the numerical field. type Vn a = V a (N a)