diagrams-builder 0.4.1 → 0.4.2
raw patch · 3 files changed
+16/−5 lines, 3 filesdep +mtl
Dependencies added: mtl
Files
- CHANGES.markdown +7/−0
- diagrams-builder.cabal +2/−1
- src/Diagrams/Builder.hs +7/−4
CHANGES.markdown view
@@ -1,3 +1,10 @@+0.4.2 (26 November 2013)+------------------------++ - `buildDiagram` now accepts expressions of type `Diagram` or `IO+ Diagram`: it just tries both.+ - Add dependency on `mtl`.+ 0.4.1 (24 November 2013) ------------------------
diagrams-builder.cabal view
@@ -1,5 +1,5 @@ name: diagrams-builder-version: 0.4.1+version: 0.4.2 synopsis: hint-based build service for the diagrams graphics EDSL. description: @diagrams-builder@ provides backend-agnostic tools for@@ -47,6 +47,7 @@ Diagrams.Builder.Modules Diagrams.Builder.CmdLine build-depends: base >=4.2 && < 4.7,+ mtl >= 2.1 && < 2.2, diagrams-lib >=0.6 && < 1.1, hint ==0.3.*, directory,
src/Diagrams/Builder.hs view
@@ -38,6 +38,7 @@ ) where import Control.Monad (guard, mplus, mzero)+import Control.Monad.Error (catchError) import Control.Monad.Trans.Maybe (MaybeT, runMaybeT) import Crypto.Hash (Digest, MD5, digestToHexByteString,@@ -110,7 +111,8 @@ where hsenvArgv = words $ fromMaybe "" (lookup "PACKAGE_DB_FOR_GHC" env) -- | Interpret a diagram expression based on the contents of a given--- source file, using some backend to produce a result.+-- source file, using some backend to produce a result. The+-- expression can be of type @Diagram b v@ or @IO (Diagram b v)@. interpretDiagram :: forall b v. ( Typeable b, Typeable v@@ -127,7 +129,7 @@ args <- liftIO getHsenvArgv unsafeRunInterpreterWithArgs args $ do setDiagramImports m imps- d <- interpret dexp (as :: Diagram b v)+ d <- interpret dexp (as :: Diagram b v) `catchError` const (interpret dexp (as :: IO (Diagram b v)) >>= liftIO) return (renderDia b opts d) -- | Pretty-print an @InterpreterError@.@@ -153,8 +155,9 @@ -- some extra information. -- | Build a diagram by writing the given source code to a temporary--- module and interpreting the given expression. Can return either--- a parse error if the source does not parse, an interpreter error,+-- module and interpreting the given expression, which can be of+-- type @Diagram b v@ or @IO (Diagram b v)@. Can return either a+-- parse error if the source does not parse, an interpreter error, -- or the final result. buildDiagram :: ( Typeable b, Typeable v