plot 0.2.3.2 → 0.2.3.3
raw patch · 5 files changed
+21/−14 lines, 5 files
Files
- THANKS +1/−0
- lib/Control/Monad/Supply.hs +5/−1
- lib/Graphics/Rendering/Plot/Render/Types.hs +3/−2
- lib/Graphics/Rendering/Plot/Types.hs +11/−10
- plot.cabal +1/−1
THANKS view
@@ -3,3 +3,4 @@ * buecking added the TickFormat data type and resulting code * takano-akio pointed out bug in interaction between non-default point size and legend placement/scaling+ * pacak updated for AMP for ghc 7.10
lib/Control/Monad/Supply.hs view
@@ -25,7 +25,8 @@ ) where ------------------------------------------------------------------------------+import Control.Applicative+import Control.Monad (ap) import Control.Monad.Writer import Control.Monad.Reader import Control.Monad.State@@ -72,6 +73,9 @@ fmap f m = SupplyT $ \s -> do ~(x, s') <- runSupplyT m s return (f x,s')+instance Monad m => Applicative (SupplyT s m) where+ pure = return+ (<*>) = ap instance Monad m => Monad (SupplyT s m) where return a = SupplyT $ \s -> return (a, s)
lib/Graphics/Rendering/Plot/Render/Types.hs view
@@ -35,6 +35,7 @@ import qualified Graphics.Rendering.Cairo.Matrix as CM import qualified Graphics.Rendering.Pango as P +import Control.Applicative import Control.Monad.Reader import Control.Monad.State --import Control.Monad.Trans@@ -52,7 +53,7 @@ ----------------------------------------------------------------------------- {- newtype Render a = FR { runRender :: StateT BoundingBox C.Render a }- deriving(Monad, MonadState BoundingBox, MonadTrans (StateT BoundingBox))+ deriving(Monad, Functor, Applicative, MonadState BoundingBox, MonadTrans (StateT BoundingBox)) -} data RenderEnv = RenderEnv {@@ -61,7 +62,7 @@ } newtype BoundedT m a = BT { runRender :: ReaderT RenderEnv (StateT BoundingBox m) a }- deriving(Monad, MonadState BoundingBox, MonadReader RenderEnv)+ deriving(Monad, Functor, Applicative, MonadState BoundingBox, MonadReader RenderEnv) instance MonadTrans BoundedT where lift m = BT $ lift $ lift m
lib/Graphics/Rendering/Plot/Types.hs view
@@ -32,6 +32,7 @@ import qualified Graphics.Rendering.Cairo as C import qualified Graphics.Rendering.Pango as P +import Control.Applicative import Control.Monad.State import Control.Monad.Reader @@ -63,7 +64,7 @@ ----------------------------------------------------------------------------- newtype Text a = FT { runText :: ReaderT TextOptions (State TextEntry) a}- deriving(Monad, MonadReader TextOptions, MonadState TextEntry)+ deriving(Monad, Functor, Applicative, MonadReader TextOptions, MonadState TextEntry) execText :: Text a -> TextOptions -> TextEntry -> TextEntry execText m r = execState (runReaderT (runText m) r) @@ -81,7 +82,7 @@ ----------------------------------------------------------------------------- newtype Point a = FG { runPoint :: ReaderT PointOptions (State PointType) a}- deriving(Monad, MonadReader PointOptions, MonadState PointType)+ deriving(Monad, Functor, Applicative, MonadReader PointOptions, MonadState PointType) execPoint :: Point a -> PointOptions -> PointType -> PointType execPoint m r = execState (runReaderT (runPoint m) r)@@ -105,7 +106,7 @@ ----------------------------------------------------------------------------- newtype Line a = FL { runLine :: ReaderT LineOptions (State LineType) a}- deriving(Monad, MonadReader LineOptions, MonadState LineType)+ deriving(Monad, Functor, Applicative, MonadReader LineOptions, MonadState LineType) execLine :: Line a -> LineOptions -> LineType -> LineType execLine m r = execState (runReaderT (runLine m) r) @@ -121,7 +122,7 @@ ----------------------------------------------------------------------------- newtype Bar a = FB { runBar :: ReaderT BarOptions (State BarType) a}- deriving(Monad, MonadReader BarOptions, MonadState BarType)+ deriving(Monad, Functor, Applicative, MonadReader BarOptions, MonadState BarType) execBar :: Bar a -> BarOptions -> BarType -> BarType execBar m r = execState (runReaderT (runBar m) r) @@ -148,7 +149,7 @@ ----------------------------------------------------------------------------- newtype Annote a = FN { runAnnote :: ReaderT Options (State Annotations) a}- deriving(Monad, MonadReader Options, MonadState Annotations)+ deriving(Monad, Functor, Applicative, MonadReader Options, MonadState Annotations) execAnnote :: Annote a -> Options -> Annotations -> Annotations execAnnote m r = execState (runReaderT (runAnnote m) r) @@ -226,7 +227,7 @@ ----------------------------------------------------------------------------- newtype Axis a = FA { runAxis :: ReaderT Options (State AxisData) a}- deriving(Monad, MonadReader Options, MonadState AxisData)+ deriving(Monad, Functor, Applicative, MonadReader Options, MonadState AxisData) execAxis :: Axis a -> Options -> AxisData -> AxisData execAxis m r = execState (runReaderT (runAxis m) r) @@ -252,7 +253,7 @@ ----------------------------------------------------------------------------- newtype Legend a = FE { runLegend :: ReaderT TextOptions (State (Maybe LegendData)) a}- deriving(Monad, MonadReader TextOptions, MonadState (Maybe LegendData))+ deriving(Monad, Functor, Applicative, MonadReader TextOptions, MonadState (Maybe LegendData)) execLegend :: Legend a -> TextOptions -> (Maybe LegendData) -> (Maybe LegendData) execLegend m r = execState (runReaderT (runLegend m) r) @@ -395,7 +396,7 @@ ----------------------------------------------------------------------------- newtype Data a = FD { runData :: SupplyT SupplyData (ReaderT Options (State DataSeries)) a }- deriving(Monad, MonadSupply SupplyData, MonadReader Options, MonadState DataSeries)+ deriving(Monad, Functor, Applicative, MonadSupply SupplyData, MonadReader Options, MonadState DataSeries) execData :: Data a -> SupplyData -> Options -> DataSeries -> DataSeries execData m r s = execState (runReaderT (runSupplyT (runData m) r) s)@@ -452,7 +453,7 @@ ----------------------------------------------------------------------------- newtype Plot a = FP { runPlot :: SupplyT SupplyData (ReaderT Options (State PlotData)) a }- deriving(Monad, MonadReader Options, MonadSupply SupplyData, MonadState PlotData)+ deriving(Monad, Functor, Applicative, MonadReader Options, MonadSupply SupplyData, MonadState PlotData) execPlot :: Plot a -> SupplyData -> Options -> PlotData -> PlotData execPlot m s r = execState (runReaderT (runSupplyT (runPlot m) s) r)@@ -506,7 +507,7 @@ } newtype Figure a = FC { runFigure :: State FigureState a }- deriving(Monad, MonadState FigureState)+ deriving(Monad, Functor, Applicative, MonadState FigureState) -----------------------------------------------------------------------------
plot.cabal view
@@ -1,5 +1,5 @@ Name: plot-Version: 0.2.3.2+Version: 0.2.3.3 License: BSD3 License-file: LICENSE Copyright: (c) A.V.H. McPhail 2010, 2012, 2013, 2014