diff --git a/src/Diagrams/TwoD.hs b/src/Diagrams/TwoD.hs index e9383e00..dcaa4ac9 100644 --- a/src/Diagrams/TwoD.hs +++ b/src/Diagrams/TwoD.hs @@ -153,12 +153,12 @@ module Diagrams.TwoD , tailStyle , shaftColor , shaftStyle - , HeadSize, headSize, headSizeA, getHeadSize, setHeadSize - , TailSize, tailSize, tailSizeA, getTailSize, setTailSize + , HeadSize, headSize, headSizeA, getHeadSize + , TailSize, tailSize, tailSizeA, getTailSize -- * Text , text, topLeftText, alignedText, baselineText - , font, fontSize, italic, oblique, bold, setFontSize + , font, fontSize, italic, oblique, bold -- * Images , Image, image diff --git a/src/Diagrams/TwoD/Arrow.hs b/src/Diagrams/TwoD/Arrow.hs index acde5974..826f2a71 100644 --- a/src/Diagrams/TwoD/Arrow.hs +++ b/src/Diagrams/TwoD/Arrow.hs @@ -72,8 +72,8 @@ module Diagrams.TwoD.Arrow , arrow' -- * Attributes - , HeadSize, headSize, headSizeA, getHeadSize, setHeadSize - , TailSize, tailSize, tailSizeA, getTailSize, setTailSize + , HeadSize, headSize, headSizeA, getHeadSize + , TailSize, tailSize, tailSizeA, getTailSize -- * Options , ArrowOpts(..) @@ -103,6 +103,7 @@ import Control.Lens (Lens', Setter', Traversal', makeLensesWith, (%~), (&), (.~), (^.)) import Data.AffineSpace +import Data.Data import Data.Default.Class import Data.Functor ((<$>)) import Data.Maybe (fromMaybe) @@ -286,7 +287,7 @@ tailSty opts = fc black (opts^.tailStyle) -- | Radius of a circumcircle around the head. newtype HeadSize = HeadSize (Last (Measure Double)) - deriving (Typeable, Semigroup) + deriving (Typeable, Data, Semigroup) instance AttributeClass HeadSize type instance V HeadSize = R2 @@ -301,19 +302,16 @@ instance Default HeadSize where -- | Set the radius of the circumcircle around the head. headSize :: (HasStyle a, V a ~ R2) => Measure Double -> a -> a -headSize = applyTAttr . HeadSize . Last - -setHeadSize :: (Measure Double) -> Style R2 -> Style R2 -setHeadSize = setAttr . HeadSize . Last +headSize = applyGTAttr . HeadSize . Last headSizeA :: (HasStyle a, V a ~ R2) => HeadSize -> a -> a -headSizeA = applyTAttr +headSizeA = applyGTAttr getHeadSize :: HeadSize -> Measure Double getHeadSize (HeadSize (Last s)) = s newtype TailSize = TailSize (Last (Measure Double)) - deriving (Typeable, Semigroup) + deriving (Typeable, Data, Semigroup) instance AttributeClass TailSize type instance V TailSize = R2 @@ -328,13 +326,10 @@ instance Default TailSize where -- | Set the radius of a circumcircle around the arrow tail. tailSize :: (HasStyle a, V a ~ R2) => Measure Double -> a -> a -tailSize = applyTAttr . TailSize . Last - -setTailSize :: (Measure Double) -> Style R2 -> Style R2 -setTailSize = setAttr . TailSize . Last +tailSize = applyGTAttr . TailSize . Last tailSizeA :: (HasStyle a, V a ~ R2) => TailSize -> a -> a -tailSizeA = applyTAttr +tailSizeA = applyGTAttr getTailSize :: TailSize -> Measure Double getTailSize (TailSize (Last s)) = s diff --git a/src/Diagrams/TwoD/Text.hs b/src/Diagrams/TwoD/Text.hs index 5a29c041..c0fe02a9 100644 --- a/src/Diagrams/TwoD/Text.hs +++ b/src/Diagrams/TwoD/Text.hs @@ -23,7 +23,7 @@ module Diagrams.TwoD.Text ( -- ** Font family , Font(..), getFont, font -- ** Font size - , FontSize(..), getFontSize, fontSize, fontSizeA, setFontSize + , FontSize(..), getFontSize, fontSize, fontSizeA -- ** Font slant , FontSlant(..), FontSlantA, getFontSlant, fontSlant, italic, oblique -- ** Font weight @@ -37,13 +37,9 @@ import Diagrams.Core.Style (setAttr) import Diagrams.TwoD.Types import Data.AffineSpace ((.-.)) - import Data.Semigroup - import Data.Colour - import Data.Default.Class - import Data.Typeable ------------------------------------------------------------ @@ -177,8 +173,6 @@ instance Default FontSize where getFontSize :: FontSize -> Measure Double getFontSize (FontSize (Last s)) = s -setFontSize :: (Measure Double) -> Style R2 -> Style R2 -setFontSize = setAttr . FontSize . Last -- | Set the font size, that is, the size of the font's em-square as -- measured within the current local vector space. The default size -- is @1@.