packages feed

diagrams-builder 0.8.0.6 → 0.8.1

raw patch · 5 files changed

+93/−71 lines, 5 filesdep −haskell-src-extsdep −mtldep ~basedep ~bytestringdep ~diagrams-cairo

Dependencies removed: haskell-src-exts, mtl

Dependency ranges changed: base, bytestring, diagrams-cairo, diagrams-lib, lens

Files

CHANGES.markdown view
@@ -1,3 +1,12 @@+## [v0.8.1](https://github.com/diagrams/diagrams-builder/tree/v0.8.1) (2026-12-02)++- Fix `diagrams-builder-rasterific` to use `Double` instead of `Float`+- Allow `diagrams-lib-1.6` and `base-4.22`+- Test with GHC 9.14, and drop support for GHC < 9.2+- Remove unneeded deps (`mtl`, `haskell-src-exts`, `lens`,+  `bytestring`)+- Fix warnings (remove use of `head`, fix redundant pattern-match)+ ## [v0.8.0.6](https://github.com/diagrams/diagrams-builder/tree/v0.8.0.6) (2023-07-10)  - Bump upper bounds: allow@@ -10,6 +19,22 @@     - `bytestring-0.11` - Test on GHC 9.4 and 9.6 - Drop support for GHC < 8.10++- r1 (2024-02-06):+    - allow `bytestring-0.12` and `base-4.19`+    - Test on GHC 9.8+    - Note as of this release the `-fcairo` flag is not supported on+      GHC 9.8.+- r2 (2024-10-16):+    - allow `filepath-1.5`, `lens-5.3`, and `hashable-1.5`+    - Note it still does not support GHC 9.10 due to dependency issues.+- r3 (2025-06-25):+    - allow `diagrams-lib-1.5`+    - allow `diagrams-svg-1.5`+    - allow `diagrams-rasterific-1.5`+    - allow `diagrams-pgf-1.5`+    - allow `base-4.21` and `base-4.22`+    - Test on GHC 9.10 and 9.12  ## [v0.8.0.5](https://github.com/diagrams/diagrams-builder/tree/v0.8.0.5) (2020-01-21) 
diagrams-builder.cabal view
@@ -1,5 +1,5 @@ name:                diagrams-builder-version:             0.8.0.6+version:             0.8.1 synopsis:            hint-based build service for the diagrams graphics EDSL.  description:         @diagrams-builder@ provides backend-agnostic tools for@@ -37,7 +37,7 @@ category:            Graphics build-type:          Simple cabal-version:       >=1.10-tested-with:         GHC ==8.10.7 || ==9.0.2 || ==9.2.7 || ==9.4.5 || ==9.6.1+tested-with:         GHC ==9.2.8 || ==9.4.8 || ==9.6.7 || ==9.8.4 || ==9.10.3 || ==9.12.4 || ==9.14.1 bug-reports:         https://github.com/diagrams/diagrams-builder/issues Source-repository head   type:     git@@ -48,20 +48,18 @@                        Diagrams.Builder.Opts                        Diagrams.Builder.Modules                        Diagrams.Builder.CmdLine-  build-depends:       base >= 4.10 && < 4.19,+  build-depends:       base >= 4.10 && < 4.23,                        base-orphans >= 0.3 && < 0.10,-                       mtl >= 2.1 && < 2.4,-                       diagrams-lib >= 1.4 && < 1.5,+                       diagrams-lib >= 1.4 && < 1.7,                        hint >= 0.4 && < 0.10,                        directory >= 1.3 && < 1.4,-                       filepath >= 1.4 && < 1.5,+                       filepath >= 1.4 && < 1.6,                        transformers >= 0.3 && < 0.7,                        split >= 0.2 && < 0.3,-                       haskell-src-exts >= 1.18 && < 1.24,                        haskell-src-exts-simple >= 1.18 && < 1.24,                        cmdargs >= 0.6 && < 0.11,-                       lens >= 4.0 && < 5.3,-                       hashable >= 1.1 && < 1.5,+                       lens >= 4.0 && < 5.4,+                       hashable >= 1.1 && < 1.6,                        exceptions >= 0.3 && < 0.11   hs-source-dirs:      src   default-language:    Haskell2010@@ -115,10 +113,9 @@                        filepath,                        directory,                        diagrams-builder,-                       diagrams-lib >= 1.4 && < 1.5,-                       diagrams-cairo >= 1.4 && < 1.5,-                       cmdargs >= 0.6 && < 0.11,-                       lens >= 4.0 && < 5.3+                       diagrams-lib >= 1.4 && < 1.7,+                       diagrams-cairo >= 1.4 && < 1.6,+                       cmdargs >= 0.6 && < 0.11  executable diagrams-builder-svg   main-is:             diagrams-builder-svg.hs@@ -135,10 +132,9 @@                        filepath,                        directory,                        diagrams-builder,-                       diagrams-lib >= 1.4 && < 1.5,-                       diagrams-svg >= 1.4 && < 1.5,+                       diagrams-lib >= 1.4 && < 1.7,+                       diagrams-svg >= 1.4 && < 1.6,                        svg-builder >= 0.1 && < 0.2,-                       bytestring >= 0.9.2 && < 0.12,                        cmdargs >= 0.6 && < 0.11  executable diagrams-builder-ps@@ -156,11 +152,10 @@                        filepath,                        directory,                        diagrams-builder,-                       diagrams-lib >= 1.4 && < 1.5,+                       diagrams-lib >= 1.4 && < 1.7,                        diagrams-postscript >= 1.4 && < 1.6,                        cmdargs >= 0.6 && < 0.11,-                       lens >= 3.8 && < 5.3,-                       bytestring >= 0.9.2 && < 0.12+                       bytestring >= 0.11.2 && < 0.13  executable diagrams-builder-rasterific   main-is:             diagrams-builder-rasterific.hs@@ -177,10 +172,9 @@                        filepath,                        directory,                        diagrams-builder,-                       diagrams-lib >= 1.4 && < 1.5,-                       diagrams-rasterific >= 1.4 && < 1.5,+                       diagrams-lib >= 1.4 && < 1.7,+                       diagrams-rasterific >= 1.4 && < 1.6,                        cmdargs >= 0.6 && < 0.11,-                       lens >= 3.8 && < 5.3,                        JuicyPixels >= 3.1.5 && < 3.4  executable diagrams-builder-pgf@@ -198,9 +192,8 @@                        filepath,                        directory,                        diagrams-builder,-                       diagrams-lib >= 1.4 && < 1.5,-                       diagrams-pgf >= 1.4 && < 1.5,-                       bytestring >= 0.10.2 && < 0.12,+                       diagrams-lib >= 1.4 && < 1.7,+                       diagrams-pgf >= 1.4 && < 1.6,+                       bytestring >= 0.11.2 && < 0.13,                        cmdargs >= 0.6 && < 0.11,-                       lens >= 3.8 && < 5.3,                        texrunner
src/Diagrams/Builder/Modules.hs view
@@ -27,6 +27,7 @@ import           Data.Function                (on) import           Data.List                    (foldl', groupBy, isPrefixOf, nub,                                                sortBy)+import qualified Data.List.NonEmpty           as NE import           Data.Maybe                   (isJust) import           Data.Ord                     (comparing) @@ -130,8 +131,8 @@     Module h combinedPragmas combinedImports (d1 ++ d2)   where     combinedPragmas = combinedLangPragmas ++ otherPragmas ps1 ++ otherPragmas ps2-    combinedImports = map head-                    . groupBy ((==) `on` importModule)+    combinedImports = map NE.head+                    . NE.groupBy ((==) `on` importModule)                     . sortBy (comparing importModule)                     $ i1 ++ i2 @@ -150,7 +151,3 @@ -- | Convert a @ModuleName@ to a @String@. getModuleName :: ModuleName -> String getModuleName (ModuleName n) = n-getModuleName m = error $ "Diagrams.Builder.Modules.getModuleName: got a ModuleName that isn't! " ++ show m-  -- GHC warns about incomplete matches because ModuleName is now a-  -- pattern synonym, and the haskell-src-exts-simple package doesn't-  -- use COMPLETE pragmas
src/tools/diagrams-builder-ps.hs view
@@ -1,6 +1,5 @@ {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE RecordWildCards    #-}-{-# LANGUAGE CPP                #-}  module Main where @@ -48,11 +47,7 @@    mkFile base = dir FP.</> base FP.<.> "eps"  writeBuilder :: FilePath -> B.Builder -> IO ()-#if MIN_VERSION_bytestring(0,11,2) writeBuilder fp b = B.writeFile fp b-#else-writeBuilder fp b = IO.withBinaryFile fp IO.WriteMode (`B.hPutBuilder` b)-#endif {-# INLINE writeBuilder #-}  build :: Build
src/tools/diagrams-builder-rasterific.hs view
@@ -1,59 +1,71 @@ {-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE RecordWildCards    #-}+{-# LANGUAGE RecordWildCards #-}  module Main where-import qualified Codec.Picture               as J-import           Diagrams.Backend.Rasterific-import           Diagrams.Prelude            hiding (height, width) -import           Diagrams.Builder+import qualified Codec.Picture as J+import Diagrams.Backend.Rasterific+import Diagrams.Prelude hiding (height, width) -import           System.Directory            (copyFile,-                                              createDirectoryIfMissing)-import qualified System.FilePath             as FP+import Diagrams.Builder -import           System.Console.CmdArgs+import System.Directory (+  copyFile,+  createDirectoryIfMissing,+ )+import qualified System.FilePath as FP +import System.Console.CmdArgs+ compileExample :: Build -> IO ()-compileExample (Build{..}) = do+compileExample (Build {..}) = do   let ext = FP.takeExtension outFile       save = case ext of-               ".png" -> J.savePngImage-               ".jpg" -> J.saveJpgImage 100-               ".bmp" -> J.saveBmpImage-               ".gif" -> (either error id .) . J.saveGifImage-               ".tiff" -> J.saveTiffImage-               _ -> J.savePngImage-  f   <- readFile srcFile+        ".png" -> J.savePngImage+        ".jpg" -> J.saveJpgImage 100+        ".bmp" -> J.saveBmpImage+        ".gif" -> (either error id .) . J.saveGifImage+        ".tiff" -> J.saveTiffImage+        _ -> J.savePngImage+  f <- readFile srcFile    createDirectoryIfMissing True dir -  let w = fmap realToFrac width :: Maybe Float-      h = fmap realToFrac height :: Maybe Float-      bopts = mkBuildOpts Rasterific (zero :: V2 Float) (RasterificOptions (mkSizeSpec2D w h))-                & snippets .~ [f]-                & imports  .~ [ "Diagrams.Backend.Rasterific" ]-                & diaExpr  .~ expr-                & decideRegen .~ (hashedRegenerate (\_ opts -> opts) dir)+  let w = fmap realToFrac width :: Maybe Double+      h = fmap realToFrac height :: Maybe Double+      bopts =+        mkBuildOpts Rasterific (zero :: V2 Double) (RasterificOptions (mkSizeSpec2D w h))+          & snippets+          .~ [f]+          & imports+          .~ ["Diagrams.Backend.Rasterific"]+          & diaExpr+          .~ expr+          & decideRegen+          .~ (hashedRegenerate (\_ opts -> opts) dir)    res <- buildDiagram bopts   case res of-    ParseErr err    -> putStrLn ("Parse error in " ++ srcFile) >> putStrLn err-    InterpErr ierr  -> putStrLn ("Error while compiling " ++ srcFile) >>-                       putStrLn (ppInterpError ierr)-    Skipped hash    -> copyFile (mkFile (hashToHexStr hash) ext) outFile-    OK hash img -> let cached = mkFile (hashToHexStr hash) ext-                   in do save cached (J.ImageRGBA8 img)-                         copyFile cached outFile+    ParseErr err -> putStrLn ("Parse error in " ++ srcFile) >> putStrLn err+    InterpErr ierr ->+      putStrLn ("Error while compiling " ++ srcFile)+        >> putStrLn (ppInterpError ierr)+    Skipped hash -> copyFile (mkFile (hashToHexStr hash) ext) outFile+    OK hash img ->+      let cached = mkFile (hashToHexStr hash) ext+       in do+            save cached (J.ImageRGBA8 img)+            copyFile cached outFile  where   mkFile base ext = dir FP.</> base FP.<.> ext  build :: Build build =   defaultBuildOpts-  { outFile  = "out.png" &= typFile &= help "Output file (default: \"out.png\")" }-  &= summary "The diagrams-builder-rasterific program, for dynamically rendering diagrams using the rasterific backend.  Give it a source file and an expression to render (which may refer to things declared in the source file), and it outputs an image, using hashing to avoid rerendering images unnecessarily.\n\nIf you have installed the diagrams-lib and diagrams-rasterific packages in a sandbox, set the environment variable DIAGRAMS_SANDBOX to that directory so the builder can compile your diagram. For example, \"export DIAGRAMS_SANDBOX=~/diagrams/.cabal-sandbox\". If you have package databases for multiple versions of GHC in that sandbox, you will need to set the full path to the package database (it ends in \".conf.d\")."-  &= program "diagrams-builder-rasterific"+    { outFile = "out.png" &= typFile &= help "Output file (default: \"out.png\")"+    }+    &= summary "The diagrams-builder-rasterific program, for dynamically rendering diagrams using the rasterific backend.  Give it a source file and an expression to render (which may refer to things declared in the source file), and it outputs an image, using hashing to avoid rerendering images unnecessarily.\n\nIf you have installed the diagrams-lib and diagrams-rasterific packages in a sandbox, set the environment variable DIAGRAMS_SANDBOX to that directory so the builder can compile your diagram. For example, \"export DIAGRAMS_SANDBOX=~/diagrams/.cabal-sandbox\". If you have package databases for multiple versions of GHC in that sandbox, you will need to set the full path to the package database (it ends in \".conf.d\")."+    &= program "diagrams-builder-rasterific"  main :: IO () main = do