chart-svg 0.8.1.1 → 0.8.2.1
raw patch · 12 files changed
+85/−73 lines, 12 filesdep +lensdep ~harpiedep ~timePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies added: lens
Dependency ranges changed: harpie, time
API changes (from Hackage documentation)
- Data.Colour: pattern Colour :: Double -> Double -> Double -> Double -> Colour
+ Chart.Bar: instance Data.Data.Data Chart.Bar.BarData
+ Chart.Bar: instance Data.Data.Data Chart.Bar.BarOptions
+ Chart.Hud: instance Data.Data.Data Chart.Hud.Adjustments
+ Chart.Hud: instance Data.Data.Data Chart.Hud.AxisBar
+ Chart.Hud: instance Data.Data.Data Chart.Hud.AxisOptions
+ Chart.Hud: instance Data.Data.Data Chart.Hud.FrameOptions
+ Chart.Hud: instance Data.Data.Data Chart.Hud.HudChart
+ Chart.Hud: instance Data.Data.Data Chart.Hud.HudChartSection
+ Chart.Hud: instance Data.Data.Data Chart.Hud.HudOptions
+ Chart.Hud: instance Data.Data.Data Chart.Hud.LegendOptions
+ Chart.Hud: instance Data.Data.Data Chart.Hud.Tick
+ Chart.Hud: instance Data.Data.Data Chart.Hud.TickExtend
+ Chart.Hud: instance Data.Data.Data Chart.Hud.TickStyle
+ Chart.Hud: instance Data.Data.Data Chart.Hud.Ticks
+ Chart.Hud: instance Data.Data.Data Chart.Hud.TitleOptions
+ Chart.Hud: instance Data.Data.Data a => Data.Data.Data (Chart.Hud.Priority a)
+ Chart.Markup: instance Data.Data.Data Chart.Markup.ChartOptions
+ Chart.Markup: instance Data.Data.Data Chart.Markup.CssOptions
+ Chart.Markup: instance Data.Data.Data Chart.Markup.MarkupOptions
+ Chart.Markup: instance Data.Data.Data Chart.Markup.PreferColorScheme
+ Chart.Markup: instance Data.Data.Data Chart.Markup.ShapeRendering
+ Chart.Primitive: instance Data.Data.Data Chart.Primitive.Chart
+ Chart.Primitive: instance Data.Data.Data Chart.Primitive.ChartAspect
+ Chart.Primitive: instance Data.Data.Data Chart.Primitive.ChartData
+ Chart.Primitive: instance Data.Data.Data Chart.Primitive.ChartTree
+ Chart.Primitive: instance Data.Data.Data Chart.Primitive.Orientation
+ Chart.Primitive: instance Data.Data.Data Chart.Primitive.Place
+ Chart.Primitive: instance Data.Data.Data Chart.Primitive.Stacked
+ Chart.Style: instance Data.Data.Data Chart.Style.Align
+ Chart.Style: instance Data.Data.Data Chart.Style.EscapeText
+ Chart.Style: instance Data.Data.Data Chart.Style.GlyphShape
+ Chart.Style: instance Data.Data.Data Chart.Style.LineCap
+ Chart.Style: instance Data.Data.Data Chart.Style.LineJoin
+ Chart.Style: instance Data.Data.Data Chart.Style.ScaleP
+ Chart.Style: instance Data.Data.Data Chart.Style.Style
+ Chart.Style: instance Data.Data.Data Chart.Style.TextAnchor
+ Chart.Surface: instance Data.Data.Data Chart.Surface.SurfaceData
+ Chart.Surface: instance Data.Data.Data Chart.Surface.SurfaceLegendOptions
+ Chart.Surface: instance Data.Data.Data Chart.Surface.SurfaceOptions
+ Chart.Surface: instance Data.Data.Data Chart.Surface.SurfaceStyle
+ Data.Colour: instance Data.Data.Data Data.Colour.Colour
+ Data.Colour: pattern Colour :: () => Double -> Double -> Double -> Double -> Colour
+ Data.Path: instance Data.Data.Data a => Data.Data.Data (Data.Path.ArcCentroid a)
+ Data.Path: instance Data.Data.Data a => Data.Data.Data (Data.Path.ArcInfo a)
+ Data.Path: instance Data.Data.Data a => Data.Data.Data (Data.Path.ArcPosition a)
+ Data.Path: instance Data.Data.Data a => Data.Data.Data (Data.Path.CubicPolar a)
+ Data.Path: instance Data.Data.Data a => Data.Data.Data (Data.Path.CubicPosition a)
+ Data.Path: instance Data.Data.Data a => Data.Data.Data (Data.Path.PathData a)
+ Data.Path: instance Data.Data.Data a => Data.Data.Data (Data.Path.QuadPolar a)
+ Data.Path: instance Data.Data.Data a => Data.Data.Data (Data.Path.QuadPosition a)
+ Data.Path.Parser: instance Data.Data.Data Data.Path.Parser.Origin
+ Data.Path.Parser: instance Data.Data.Data Data.Path.Parser.PathCommand
+ Data.Path.Parser: instance Data.Data.Data Data.Path.Parser.PathCursor
Files
- ChangeLog.md +5/−1
- chart-svg.cabal +2/−1
- readme.md +0/−4
- src/Chart/Bar.hs +3/−2
- src/Chart/Hud.hs +17/−15
- src/Chart/Markup.hs +12/−5
- src/Chart/Primitive.hs +15/−8
- src/Chart/Style.hs +9/−8
- src/Chart/Surface.hs +5/−4
- src/Data/Colour.hs +4/−14
- src/Data/Path.hs +9/−8
- src/Data/Path/Parser.hs +4/−3
ChangeLog.md view
@@ -1,8 +1,12 @@+0.8.2+===++- added Data instances+ 0.8.1 === - bumped upper bounds for markup-parse and containers.- 0.8 ===
chart-svg.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: chart-svg-version: 0.8.1.1+version: 0.8.2.1 license: BSD-3-Clause license-file: LICENSE copyright: Tony Day (c) 2017@@ -87,6 +87,7 @@ flatparse >=0.5 && <0.6, formatn >=0.3 && <0.4, harpie >=0.1 && <0.2,+ lens >=5 && <5.4, markup-parse >=0.1 && <0.3, mtl >=2.2.2 && <2.4, numhask >=0.11 && <0.14,
readme.md view
@@ -8,7 +8,6 @@ # Usage :r- :set prompt "> " :set -XOverloadedLabels :set -XOverloadedStrings import Chart@@ -23,12 +22,9 @@ See the haddock documentation for a detailed overview. -# Examples- To redraw all the examples in Chart.Examples import Chart.Examples writeAllExamples - ok
src/Chart/Bar.hs view
@@ -21,6 +21,7 @@ import Chart.Style import Data.Bool import Data.Colour+import Data.Data import Data.Foldable import Data.FormatN import Data.List (transpose)@@ -79,7 +80,7 @@ barStacked :: Stacked, barLegendOptions :: LegendOptions }- deriving (Show, Eq, Generic)+ deriving (Eq, Show, Generic, Data) -- | The official bar options. defaultBarOptions :: BarOptions@@ -197,7 +198,7 @@ barRowLabels :: [Text], barColumnLabels :: [Text] }- deriving (Show, Eq, Generic)+ deriving (Eq, Show, Generic, Data) -- | Calculate the Rect range of a bar data set. --
src/Chart/Hud.hs view
@@ -1,5 +1,4 @@ {-# LANGUAGE DuplicateRecordFields #-}-{-# LANGUAGE LambdaCase #-} {-# LANGUAGE OverloadedLabels #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RebindableSyntax #-}@@ -86,6 +85,7 @@ import Data.Bifunctor import Data.Bool import Data.Colour+import Data.Data import Data.Foldable hiding (sum) import Data.FormatN import Data.List qualified as List@@ -135,7 +135,9 @@ -- > priorityv2Example = priorityv1Example & #hudOptions % #titles %~ fmap (first (const (Priority 51))) -- -- -data Priority a = Priority {priority :: Double, item :: a} deriving (Eq, Ord, Show, Generic, Functor)+data Priority a+ = Priority {priority :: Double, item :: a}+ deriving (Eq, Ord, Show, Generic, Data, Functor) -- | Heads-up display additions to charts newtype Hud = Hud {phud :: Priority (HudChart -> ChartTree)} deriving (Generic)@@ -149,7 +151,7 @@ { chartSection :: ChartTree, hudSection :: ChartTree }- deriving (Eq, Show, Generic)+ deriving (Eq, Show, Generic, Data) -- | A type for Rect to represent the bounding box of a chart. type ChartBox = Rect Double@@ -167,7 +169,7 @@ HudSection | -- | The hud and canvas sections, including style HudStyleSection- deriving (Eq, Show, Generic)+ deriving (Eq, Show, Generic, Data) -- | The 'Rect' of a particular 'HudChartSection' of a 'HudChart' hudChartBox' :: HudChartSection -> Getter HudChart (Maybe (Rect Double))@@ -266,7 +268,7 @@ legends :: [Priority LegendOptions], titles :: [Priority TitleOptions] }- deriving (Eq, Show, Generic)+ deriving (Eq, Show, Generic, Data) instance Semigroup HudOptions where (<>) (HudOptions a c l t) (HudOptions a' c' l' t') =@@ -334,7 +336,7 @@ ticks :: Ticks, place :: Place }- deriving (Eq, Show, Generic)+ deriving (Eq, Show, Generic, Data) -- | The official X-axis defaultXAxisOptions :: AxisOptions@@ -357,7 +359,7 @@ -- | Which hud-chart section to anchor to anchorTo :: HudChartSection }- deriving (Show, Eq, Generic)+ deriving (Eq, Show, Generic, Data) -- | The official axis bar defaultAxisBar :: AxisBar@@ -374,7 +376,7 @@ anchoring :: Double, buffer :: Double }- deriving (Show, Eq, Generic)+ deriving (Eq, Show, Generic, Data) -- | The official hud title defaultTitleOptions :: Text -> TitleOptions@@ -398,7 +400,7 @@ textTick :: Maybe TickStyle, lineTick :: Maybe TickStyle }- deriving (Show, Eq, Generic)+ deriving (Eq, Show, Generic, Data) -- | Common elements across all tick types. data TickStyle = TickStyle@@ -406,7 +408,7 @@ anchorTo :: HudChartSection, buffer :: Double }- deriving (Show, Eq, Generic)+ deriving (Eq, Show, Generic, Data) -- | The official glyph tick defaultGlyphTickStyleX :: TickStyle@@ -485,7 +487,7 @@ TickExact FormatN Int | -- | specific labels and placement TickPlaced [(Double, Text)]- deriving (Show, Eq, Generic)+ deriving (Eq, Show, Generic, Data) -- | Lens between a FormatN and a Tick. formatN' :: Lens' Tick (Maybe FormatN)@@ -546,7 +548,7 @@ defaultTick = TickRound (FormatN FSCommaPrec (Just 1) 4 True True) 5 TickExtend -- | Whether Ticks are allowed to extend the data range-data TickExtend = TickExtend | NoTickExtend deriving (Eq, Show, Generic)+data TickExtend = TickExtend | NoTickExtend deriving (Eq, Show, Generic, Data) -- | options for prettifying axis decorations --@@ -558,7 +560,7 @@ angledRatio :: Double, allowDiagonal :: Bool }- deriving (Show, Eq, Generic)+ deriving (Eq, Show, Generic, Data) -- | The official hud adjustments. defaultAdjustments :: Adjustments@@ -586,7 +588,7 @@ scaleP :: ScaleP, legendCharts :: [(Text, [Chart])] }- deriving (Show, Eq, Generic)+ deriving (Eq, Show, Generic, Data) -- | The official legend options defaultLegendOptions :: LegendOptions@@ -618,7 +620,7 @@ anchorTo :: HudChartSection, buffer :: Double }- deriving (Eq, Show, Generic)+ deriving (Eq, Show, Generic, Data) -- | The official hud frame defaultFrameOptions :: FrameOptions
src/Chart/Markup.hs view
@@ -40,6 +40,7 @@ import Data.Bool import Data.ByteString (ByteString, intercalate, writeFile) import Data.Colour+import Data.Data import Data.FormatN import Data.Maybe import Data.Path@@ -408,7 +409,7 @@ cssOptions :: CssOptions, renderStyle :: RenderStyle }- deriving (Eq, Show, Generic)+ deriving (Eq, Show, Generic, Data) -- | The official markup options defaultMarkupOptions :: MarkupOptions@@ -427,7 +428,11 @@ |] -- | CSS glyphShape rendering options-data ShapeRendering = UseGeometricPrecision | UseCssCrisp | NoShapeRendering deriving (Show, Eq, Generic)+data ShapeRendering+ = UseGeometricPrecision+ | UseCssCrisp+ | NoShapeRendering+ deriving (Eq, Show, Generic, Data) -- | CSS prefer-color-scheme options data PreferColorScheme@@ -436,13 +441,15 @@ | PreferDark | PreferLight | PreferNormal- deriving (Show, Eq, Generic)+ deriving (Eq, Show, Generic, Data) -- | css options -- -- >>> defaultCssOptions -- CssOptions {shapeRendering = NoShapeRendering, preferColorScheme = PreferHud, fontFamilies = "\nsvg { font-family: system-ui,-apple-system,\"Segoe UI\",Roboto,\"Helvetica Neue\",Arial,\"Noto Sans\",\"Liberation Sans\",sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\";\n}\n\nticktext { font-family: SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace;\n}\n\n", cssExtra = ""}-data CssOptions = CssOptions {shapeRendering :: ShapeRendering, preferColorScheme :: PreferColorScheme, fontFamilies :: ByteString, cssExtra :: ByteString} deriving (Show, Eq, Generic)+data CssOptions+ = CssOptions {shapeRendering :: ShapeRendering, preferColorScheme :: PreferColorScheme, fontFamilies :: ByteString, cssExtra :: ByteString}+ deriving (Eq, Show, Generic, Data) -- | No special shape rendering and default hud responds to user color scheme preferences. defaultCssOptions :: CssOptions@@ -469,7 +476,7 @@ hudOptions :: HudOptions, chartTree :: ChartTree }- deriving (Generic, Eq, Show)+ deriving (Eq, Show, Generic, Data) -- | Processes the hud options and turns them into charts, rescales the existing charts, resets the hud options to mempty, and turns on 'ScalePArea' in chart styles. --
src/Chart/Primitive.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE GADTs #-} {-# LANGUAGE OverloadedLabels #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE PatternSynonyms #-}@@ -81,6 +80,7 @@ import Data.Bifunctor import Data.Bool import Data.Colour+import Data.Data import Data.Foldable import Data.Maybe import Data.Path@@ -114,7 +114,12 @@ -- > writeChartOptions "other/unit.hs" $ mempty & #hudOptions .~ defaultHudOptions & #chartTree .~ unnamed [r] -- -- -data Chart = Chart {chartStyle :: Style, chartData :: ChartData} deriving (Eq, Show, Generic)+data Chart+ = Chart+ { chartStyle :: Style,+ chartData :: ChartData+ }+ deriving (Eq, Show, Generic, Data) -- | Data of a 'Chart' --@@ -139,7 +144,7 @@ PathData [PathData Double] | -- | List of rectangles with no 'Style' representation BlankData [Rect Double]- deriving (Eq, Show, Generic)+ deriving (Eq, Show, Generic, Data) -- | RectData partial lens rectData' :: Lens' ChartData (Maybe [Rect Double])@@ -248,7 +253,9 @@ blankChart1 r = Chart defaultStyle (BlankData [r]) -- | A group of charts represented by a 'Tree' of chart lists with labelled branches. The labelling is particularly useful downstream, when groupings become grouped SVG elements with classes or ids.-newtype ChartTree = ChartTree {tree :: Tree (Maybe Text, [Chart])} deriving (Eq, Show, Generic)+newtype ChartTree+ = ChartTree {tree :: Tree (Maybe Text, [Chart])}+ deriving (Eq, Show, Generic, Data) -- | Group a list of trees into a new tree. group :: Maybe Text -> [ChartTree] -> ChartTree@@ -540,10 +547,10 @@ pointize_ (GlyphData xs) = GlyphData xs -- | Verticle or Horizontal-data Orientation = Vert | Hori deriving (Eq, Show, Generic)+data Orientation = Vert | Hori deriving (Eq, Show, Generic, Data) -- | Whether to stack chart data-data Stacked = Stacked | NonStacked deriving (Eq, Show, Generic)+data Stacked = Stacked | NonStacked deriving (Eq, Show, Generic, Data) -- | The basis for the x-y ratio of a chart --@@ -557,7 +564,7 @@ ChartAspect | -- | Do not rescale charts. The style values should make sense in relation to the data ranges. UnscaledAspect- deriving (Show, Eq, Generic)+ deriving (Eq, Show, Generic, Data) -- | Rectangular placement data Place@@ -566,7 +573,7 @@ | PlaceTop | PlaceBottom | PlaceAbsolute (Point Double)- deriving (Show, Eq, Generic)+ deriving (Eq, Show, Generic, Data) -- | Flip Place to the opposite side, or negate if 'PlaceAbsolute'. --
src/Chart/Style.hs view
@@ -53,6 +53,7 @@ import Data.Bool import Data.ByteString (ByteString) import Data.Colour+import Data.Data import Data.List qualified as List import Data.Maybe import Data.Path@@ -114,7 +115,7 @@ -- | shape for glyph chart elements glyphShape :: GlyphShape }- deriving (Eq, Show, Generic)+ deriving (Eq, Show, Generic, Data) -- | The official default style --@@ -188,7 +189,7 @@ border s c = defaultRectStyle & set #borderSize s & set #borderColor c & set #color transparent -- | Whether to escape the common XML escaped characters.-data EscapeText = EscapeText | NoEscapeText deriving (Eq, Show, Generic)+data EscapeText = EscapeText | NoEscapeText deriving (Eq, Show, Generic, Data) -- | the extra area from text styling styleBoxText ::@@ -226,7 +227,7 @@ | VLineGlyph | HLineGlyph | PathGlyph ByteString- deriving (Show, Eq, Generic)+ deriving (Eq, Show, Generic, Data) -- | the extra area from glyph styling styleBoxGlyph :: Style -> Rect Double@@ -270,7 +271,7 @@ ] -- | line cap style-data LineCap = LineCapButt | LineCapRound | LineCapSquare deriving (Eq, Show, Generic)+data LineCap = LineCapButt | LineCapRound | LineCapSquare deriving (Eq, Show, Generic, Data) -- | svg textifier fromLineCap :: (IsString s) => LineCap -> s@@ -286,7 +287,7 @@ toLineCap _ = LineCapButt -- | line cap style-data LineJoin = LineJoinMiter | LineJoinBevel | LineJoinRound deriving (Eq, Show, Generic)+data LineJoin = LineJoinMiter | LineJoinBevel | LineJoinRound deriving (Eq, Show, Generic, Data) -- | svg textifier fromLineJoin :: (IsString s) => LineJoin -> s@@ -302,7 +303,7 @@ toLineJoin _ = LineJoinMiter -- | Text Anchor-data TextAnchor = AnchorMiddle | AnchorStart | AnchorEnd deriving (Eq, Show, Generic)+data TextAnchor = AnchorMiddle | AnchorStart | AnchorEnd deriving (Eq, Show, Generic, Data) -- | Convert a 'TextAnchor' to a 'ByteString' label. fromTextAnchor :: TextAnchor -> ByteString@@ -318,7 +319,7 @@ LT -> AnchorStart -- | Aligning stacked things.-data Align = NoAlign | AlignRight | AlignLeft | AlignMid deriving (Eq, Show, Generic)+data Align = NoAlign | AlignRight | AlignLeft | AlignMid deriving (Eq, Show, Generic, Data) -- | Scale Projection options data ScaleP@@ -332,7 +333,7 @@ ScalePMinDim | -- | Scale based on the area ratio of a projection ScalePArea- deriving (Generic, Eq, Show)+ deriving (Eq, Show, Generic, Data) -- | given a ScaleP and two Rects, what is the scaling factor for a projection --
src/Chart/Surface.hs view
@@ -28,6 +28,7 @@ import Data.Bifunctor import Data.Bool import Data.Colour+import Data.Data import Data.Foldable import Data.FormatN import Data.Maybe@@ -52,7 +53,7 @@ -- | Chart range soRange :: Rect Double }- deriving (Show, Eq, Generic)+ deriving (Eq, Show, Generic, Data) -- | official style defaultSurfaceOptions :: SurfaceOptions@@ -70,7 +71,7 @@ surfaceColors :: [Colour], surfaceRectStyle :: Style }- deriving (Show, Eq, Generic)+ deriving (Eq, Show, Generic, Data) -- | The official surface style. defaultSurfaceStyle :: SurfaceStyle@@ -84,7 +85,7 @@ -- | Surface colour. surfaceColor :: Colour }- deriving (Show, Eq, Generic)+ deriving (Eq, Show, Generic, Data) -- | surface chart without any hud trimmings surfaces :: Style -> [SurfaceData] -> [Chart]@@ -133,7 +134,7 @@ sloRect :: Rect Double, sloSurfaceStyle :: SurfaceStyle }- deriving (Eq, Show, Generic)+ deriving (Eq, Show, Generic, Data) -- | 'AxisOptions' for a surface chart legend. surfaceLegendAxisOptions :: AxisOptions
src/Data/Colour.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE DataKinds #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE QuasiQuotes #-}@@ -64,6 +63,7 @@ import Chart.Data import Data.Bool (bool) import Data.ByteString (ByteString)+import Data.Data import Data.FormatN import Data.List qualified as List import Data.String.Interpolate@@ -88,19 +88,9 @@ -- >>> import Chart -- >>> import Optics.Core --- | Colour type for the library, wrapping 'Color'.-newtype Colour = Colour'- { color' :: Color (Alpha RGB) Double- }- deriving (Eq, Generic)---- | Constructor pattern.------ > Colour red green blue alpha-pattern Colour :: Double -> Double -> Double -> Double -> Colour-pattern Colour r g b a = Colour' (ColorRGBA r g b a)--{-# COMPLETE Colour #-}+-- | Colour type for the library: red, green, blue, opacity in [0,1].+data Colour = Colour Double Double Double Double+ deriving (Eq, Generic, Data) instance Show Colour where show (Colour r g b a) =
src/Data/Path.hs view
@@ -45,6 +45,7 @@ where import Chart.Data+import Data.Data import GHC.Generics import Geom2D.CubicBezier qualified as B import NumHask.Prelude@@ -78,7 +79,7 @@ QuadP (Point a) (Point a) | -- arc ArcP (ArcInfo a) (Point a)- deriving (Show, Eq, Generic)+ deriving (Eq, Show, Generic, Data) -- | View the Point part of a PathData pointPath :: PathData a -> Point a@@ -151,7 +152,7 @@ -- | sweep means clockwise clockwise :: Bool }- deriving (Eq, Show, Generic)+ deriving (Eq, Show, Generic, Data) -- | Specification of an Arc using positional referencing as per SVG standard. data ArcPosition a = ArcPosition@@ -159,7 +160,7 @@ posEnd :: Point a, posInfo :: ArcInfo a }- deriving (Eq, Show, Generic)+ deriving (Eq, Show, Generic, Data) -- | Arc specification based on centroidal interpretation. --@@ -176,7 +177,7 @@ -- | difference between ending point angle and starting point angle angdiff :: a }- deriving (Eq, Show, Generic)+ deriving (Eq, Show, Generic, Data) -- | convert from an ArcPosition spec to ArcCentroid spec. --@@ -292,7 +293,7 @@ -- | control point qposControl :: Point a }- deriving (Eq, Show, Generic)+ deriving (Eq, Show, Generic, Data) -- | Quadratic bezier curve with control point expressed in polar terms normalised to the start - end line. data QuadPolar a = QuadPolar@@ -303,7 +304,7 @@ -- | control point in terms of distance from and angle to the qp0 - qp2 line qpolControl :: Polar a }- deriving (Eq, Show, Generic)+ deriving (Eq, Show, Generic, Data) -- | Convert from a positional to a polar representation of a cubic bezier. --@@ -378,7 +379,7 @@ -- | control point 2 cposControl2 :: Point a }- deriving (Eq, Show, Generic)+ deriving (Eq, Show, Generic, Data) -- | A polar representation of a cubic bezier with control points expressed as polar and normalised to the start - end line. data CubicPolar a = CubicPolar@@ -391,7 +392,7 @@ -- | control point in terms of distance from and angle to the start end line cpolControl2 :: Polar a }- deriving (Eq, Show, Generic)+ deriving (Eq, Show, Generic, Data) -- | Convert from a positional to a polar representation of a cubic bezier. --
src/Data/Path/Parser.hs view
@@ -22,6 +22,7 @@ import Control.Monad.State.Lazy import Data.ByteString (ByteString, intercalate) import Data.Char hiding (isDigit)+import Data.Data import Data.FormatN import Data.Path (ArcInfo (ArcInfo), PathData (..)) import Data.Text.Encoding (encodeUtf8)@@ -209,7 +210,7 @@ EllipticalArc !Origin ![(Double, Double, Double, Bool, Bool, Point Double)] | -- | Close the path, Z or z svg path command. EndPath- deriving (Eq, Show, Generic)+ deriving (Eq, Show, Generic, Data) -- | Tell if a path command is absolute (in the current -- user coordiante) or relative to the previous point.@@ -218,7 +219,7 @@ OriginAbsolute | -- | Next point relative to the previous OriginRelative- deriving (Eq, Show, Generic)+ deriving (Eq, Show, Generic, Data) pointToSvgCoords :: Point Double -> Point Double pointToSvgCoords (Point x y) = Point x (-y)@@ -307,7 +308,7 @@ -- | last control point curControl :: Maybe (Point Double) }- deriving (Eq, Show, Generic)+ deriving (Eq, Show, Generic, Data) stateCur0 :: PathCursor stateCur0 = PathCursor zero zero Nothing