diagrams-postscript 1.0.0.2 → 1.0.1
raw patch · 2 files changed
+14/−4 lines, 2 filesdep +ghc-primdep +hashable
Dependencies added: ghc-prim, hashable
Files
diagrams-postscript.cabal view
@@ -1,5 +1,5 @@ Name: diagrams-postscript-Version: 1.0.0.2+Version: 1.0.1 Synopsis: Postscript backend for diagrams drawing EDSL Description: This package provides a modular backend for rendering diagrams created with the diagrams EDSL using Postscript.@@ -40,6 +40,9 @@ split >= 0.1.2 && < 0.3, monoid-extras >= 0.3 && < 0.4, semigroups >= 0.3.4 && < 0.13,- lens >= 3.8 && < 4+ lens >= 3.8 && < 4,+ hashable >= 1.1 && < 1.3+ if impl(ghc < 7.6)+ build-depends: ghc-prim default-language: Haskell2010
src/Diagrams/Backend/Postscript.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GADTs #-}@@ -60,9 +61,11 @@ import Data.Maybe (catMaybes) import qualified Data.Foldable as F+import Data.Hashable (Hashable) import qualified Data.List.NonEmpty as N import Data.Monoid.Split import Data.Typeable+import GHC.Generics (Generic) -- | This data declaration is simply used as a token to distinguish this rendering engine. data Postscript = Postscript@@ -73,8 +76,10 @@ -- | Postscript only supports EPS style output at the moment. Future formats would each -- have their own associated properties that affect the output. data OutputFormat = EPS -- ^ Encapsulated Postscript output.- deriving (Eq, Ord, Read, Show, Enum, Bounded, Typeable)+ deriving (Eq, Ord, Read, Show, Enum, Bounded, Typeable, Generic) +instance Hashable OutputFormat+ instance Monoid (Render Postscript R2) where mempty = C $ return () (C x) `mappend` (C y) = C (x >> y)@@ -88,7 +93,7 @@ , _psSizeSpec :: SizeSpec2D -- ^ the requested size of the output , _psOutputFormat :: OutputFormat -- ^ the output format and associated options }- deriving Show+ deriving (Show, Generic) withStyle _ s t (C r) = C $ do C.save@@ -112,6 +117,8 @@ adjustDia c opts d = adjustDia2D _psSizeSpec setPsSize c opts d where setPsSize sz o = o { _psSizeSpec = sz }++instance Hashable (Options Postscript R2) sizeFromSpec :: SizeSpec2D -> (Double, Double) sizeFromSpec size = case size of