module Capabilities.Diagrams (
MonadDiagrams (lin, renderDiagram),
) where
import Control.Monad.Trans.Class (MonadTrans (lift))
import Control.OutputCapable.Blocks.Generic (
GenericReportT
)
import Data.ByteString (ByteString)
import Data.Data (Typeable)
import Diagrams.Backend.SVG (SVG)
import Diagrams.Prelude (QDiagram)
import Diagrams.TwoD (V2)
import Graphics.SVGFonts.ReadFont (PreparedFont)
class Monad m => MonadDiagrams m where
lin :: (Read n, RealFloat n) => m (PreparedFont n)
renderDiagram
:: (Show n, Typeable n, RealFloat n, Monoid o)
=> QDiagram SVG V2 n o
-> m ByteString
instance MonadDiagrams m => MonadDiagrams (GenericReportT l o m) where
lin :: forall n.
(Read n, RealFloat n) =>
GenericReportT l o m (PreparedFont n)
lin = m (PreparedFont n) -> GenericReportT l o m (PreparedFont n)
forall (m :: * -> *) a. Monad m => m a -> GenericReportT l o m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m (PreparedFont n)
forall n. (Read n, RealFloat n) => m (PreparedFont n)
forall (m :: * -> *) n.
(MonadDiagrams m, Read n, RealFloat n) =>
m (PreparedFont n)
lin
renderDiagram :: forall n o.
(Show n, Typeable n, RealFloat n, Monoid o) =>
QDiagram SVG V2 n o -> GenericReportT l o m ByteString
renderDiagram = m ByteString -> GenericReportT l o m ByteString
forall (m :: * -> *) a. Monad m => m a -> GenericReportT l o m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m ByteString -> GenericReportT l o m ByteString)
-> (QDiagram SVG V2 n o -> m ByteString)
-> QDiagram SVG V2 n o
-> GenericReportT l o m ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. QDiagram SVG V2 n o -> m ByteString
forall n o.
(Show n, Typeable n, RealFloat n, Monoid o) =>
QDiagram SVG V2 n o -> m ByteString
forall (m :: * -> *) n o.
(MonadDiagrams m, Show n, Typeable n, RealFloat n, Monoid o) =>
QDiagram SVG V2 n o -> m ByteString
renderDiagram