diagrams-lib 1.2.0.3 → 1.2.0.4
raw patch · 3 files changed
+26/−22 lines, 3 filesdep −safedep ~optparse-applicativePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies removed: safe
Dependency ranges changed: optparse-applicative
API changes (from Hackage documentation)
- Diagrams.BoundingBox: instance Typeable1 BoundingBox
- Diagrams.BoundingBox: instance Typeable1 NonEmptyBoundingBox
- Diagrams.Path: instance Typeable1 Path
- Diagrams.ThreeD.Camera: instance Typeable1 Camera
- Diagrams.TwoD.Image: instance Typeable1 DImage
- Diagrams.TwoD.Transform.ScaleInv: instance Typeable1 ScaleInv
+ Diagrams.BoundingBox: instance Typeable BoundingBox
+ Diagrams.BoundingBox: instance Typeable NonEmptyBoundingBox
+ Diagrams.Path: instance Typeable Path
+ Diagrams.ThreeD.Camera: instance Typeable Camera
+ Diagrams.TwoD.Image: instance Typeable DImage
+ Diagrams.TwoD.Transform.ScaleInv: instance Typeable ScaleInv
- Diagrams.Backend.CmdLine: readHexColor :: String -> Maybe (AlphaColour Double)
+ Diagrams.Backend.CmdLine: readHexColor :: (Applicative m, Monad m) => String -> m (AlphaColour Double)
- Diagrams.Coordinates: (:&) :: a -> b -> :& a b
+ Diagrams.Coordinates: (:&) :: a -> b -> (:&) a b
- Diagrams.Names: class (Typeable a, Ord a, Show a) => IsName a
+ Diagrams.Names: class (Typeable * a, Ord a, Show a) => IsName a
- Diagrams.Segment: oeEnvelope :: Lens' (OffsetEnvelope v_aBew) (Envelope v_aBew)
+ Diagrams.Segment: oeEnvelope :: Lens' (OffsetEnvelope v_aEDf) (Envelope v_aEDf)
- Diagrams.Segment: oeOffset :: Lens' (OffsetEnvelope v_aBew) (TotalOffset v_aBew)
+ Diagrams.Segment: oeOffset :: Lens' (OffsetEnvelope v_aEDf) (TotalOffset v_aEDf)
- Diagrams.TwoD.Transform.ScaleInv: scaleInvDir :: Lens' (ScaleInv t_avcF) R2
+ Diagrams.TwoD.Transform.ScaleInv: scaleInvDir :: Lens' (ScaleInv t_azor) R2
- Diagrams.TwoD.Transform.ScaleInv: scaleInvLoc :: Lens' (ScaleInv t_avcF) P2
+ Diagrams.TwoD.Transform.ScaleInv: scaleInvLoc :: Lens' (ScaleInv t_azor) P2
- Diagrams.TwoD.Transform.ScaleInv: scaleInvObj :: Lens (ScaleInv t_avcF) (ScaleInv t_avdQ) t_avcF t_avdQ
+ Diagrams.TwoD.Transform.ScaleInv: scaleInvObj :: Lens (ScaleInv t_azor) (ScaleInv t_azqj) t_azor t_azqj
Files
- CHANGES.markdown +7/−2
- diagrams-lib.cabal +2/−3
- src/Diagrams/Backend/CmdLine.hs +17/−17
CHANGES.markdown view
@@ -1,12 +1,17 @@+1.2.0.4 (8 October 2014)+------------------------++- Allow and require `optparse-applicative-0.11`+ 1.2.0.3 (7 September 2014) -------------------------- -- Allow optparse-applicative-0.10+- Allow `optparse-applicative-0.10` 1.2.0.2 (22 August 2014) ------------------------ -- Allow lens-4.4+- Allow `lens-4.4` 1.2.0.1 (4 June 2014) ---------------------
diagrams-lib.cabal view
@@ -1,5 +1,5 @@ Name: diagrams-lib-Version: 1.2.0.3+Version: 1.2.0.4 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@@ -107,9 +107,8 @@ intervals >= 0.7 && < 0.8, lens >= 4.0 && < 4.5, tagged >= 0.7,- optparse-applicative >= 0.10 && < 0.11,+ optparse-applicative >= 0.11 && < 0.12, filepath,- safe >= 0.2 && < 0.4, JuicyPixels >= 3.1.5 && < 3.2, hashable >= 1.1 && < 1.3 if impl(ghc < 7.6)
src/Diagrams/Backend/CmdLine.hs view
@@ -77,6 +77,7 @@ import Diagrams.Core hiding (value) import Options.Applicative+import Options.Applicative.Types (readerAsk) import Prelude @@ -93,8 +94,6 @@ import Numeric -import Safe (readMay)- import System.Environment (getProgName) import System.FilePath (addExtension, splitExtension) @@ -232,19 +231,19 @@ -- certainly want the latter. So we need to have less Read instances. -- -- instance Read a => Parseable a where--- parser = argument readMay mempty+-- parser = argument auto mempty -- | Parse 'Int' according to its 'Read' instance. instance Parseable Int where- parser = argument readMay mempty+ parser = argument auto mempty -- | Parse 'Double' according to its 'Read' instance. instance Parseable Double where- parser = argument readMay mempty+ parser = argument auto mempty -- | Parse a string by just accepting the given string. instance Parseable String where- parser = argument Just mempty+ parser = argument str mempty -- | Parse 'DiagramOpts' using the 'diagramOpts' parser. instance Parseable DiagramOpts where@@ -266,20 +265,21 @@ -- | Parse @'Colour' Double@ as either a named color from "Data.Colour.Names" -- or a hexadecimal color. instance Parseable (Colour Double) where- parser = argument (liftA2 (<|>) rc rh) mempty+ parser = argument (rc <|> rh) mempty where- rh s = (f . colorToSRGBA) <$> readHexColor s- rc s = readColourName s+ rh, rc :: ReadM (Colour Double)+ rh = f . colorToSRGBA <$> (readerAsk >>= readHexColor)+ rc = readerAsk >>= readColourName f (r,g,b,_) = sRGB r g b -- TODO: this seems unfortunate. Should the alpha -- value be applied to the r g b values? -- | Parse @'AlphaColour' Double@ as either a named color from "Data.Colour.Names" -- or a hexadecimal color. instance Parseable (AlphaColour Double) where- parser = argument (liftA2 (<|>) rc rh) mempty+ parser = argument (rc <|> rh) mempty where- rh s = readHexColor s- rc s = opaque <$> readColourName s+ rh = readerAsk >>= readHexColor+ rc = opaque <$> (readerAsk >>= readColourName) -- Addapted from the Clay.Color module of the clay package @@ -289,7 +289,7 @@ -- example, @\"0xfc4\"@ is the same as @\"0xffcc44\"@. When eight or six -- digits are given each pair of digits is a color or alpha channel with the -- order being red, green, blue, alpha.-readHexColor :: String -> Maybe (AlphaColour Double)+readHexColor :: (Applicative m, Monad m) => String -> m (AlphaColour Double) readHexColor cs = case cs of ('0':'x':hs) -> handle hs ('#':hs) -> handle hs@@ -301,14 +301,14 @@ [a,b,c,d,e,f ] -> opaque <$> (sRGB <$> hex a b <*> hex c d <*> hex e f) [a,b,c,d ] -> withOpacity <$> (sRGB <$> hex a a <*> hex b b <*> hex c c) <*> hex d d [a,b,c ] -> opaque <$> (sRGB <$> hex a a <*> hex b b <*> hex c c)- _ -> Nothing- handle _ = Nothing+ _ -> fail $ "could not parse as a colour" ++ cs+ handle _ = fail $ "could not parse as a colour: " ++ cs isHexDigit c = isDigit c|| c `elem` "abcdef" hex a b = (/ 255) <$> case readHex [a,b] of- [(h,"")] -> Just h- _ -> Nothing+ [(h,"")] -> return h+ _ -> fail $ "could not parse as a hex value" ++ (a:b:[]) -- | This instance is needed to signal the end of a chain of