Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion diagrams-lib.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Library
Diagrams.Attributes,
Diagrams.Attributes.Compile,
Diagrams.Backend.CmdLine,
Diagrams.Backend.Build,
Diagrams.BoundingBox,
Diagrams.Combinators,
Diagrams.Coordinates,
Expand Down Expand Up @@ -121,7 +122,9 @@ Library
unordered-containers >= 0.2 && < 0.2.6,
system-filepath >= 0.2 && < 0.5,
text >= 0.7.1 && < 1.3,
mtl >= 2.0 && < 2.3
mtl >= 2.0 && < 2.3,
transformers >= 0.3.0 && < 0.5.0,
exceptions >= 0.6 && < 1.0
if impl(ghc < 7.6)
Build-depends: ghc-prim
Hs-source-dirs: src
Expand Down
30 changes: 30 additions & 0 deletions src/Diagrams/Backend/Build.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{-# LANGUAGE MultiParamTypeClasses #-}

-----------------------------------------------------------------------------
-- |
-- Module : Diagrams.Builder.Class
-- Copyright : (c) 2014 diagrams-lib team (see LICENSE)
-- License : BSD-style (see LICENSE)
-- Maintainer : diagrams-discuss@googlegroups.com
--
-- General class for building diagrams to files.
--
-----------------------------------------------------------------------------
module Diagrams.Backend.Build where

import Diagrams.Core
import Diagrams.Size
import Data.Monoid (Any)
import Linear.V2
import Control.Lens (Lens')

-- | Generic class for building diagrams whose output is a file with a
-- 2D size.
class Backend b v n => BackendBuild b v n where
-- | Lens onto the size of the output file.
outputSize :: Lens' (Options b v n) (SizeSpec V2 n)

-- | Build a diagram of the given format to the path using the
-- backend's options. The @Maybe String@ returns any errors.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What Maybe String?

saveDia :: FilePath -> Options b v n -> QDiagram b v n Any -> IO ()

Loading