puzzle-draw-cmdline 0.1.0.1 → 0.1.0.2
raw patch · 3 files changed
+6/−76 lines, 3 filesdep ~diagrams-lib
Dependency ranges changed: diagrams-lib
Files
- CHANGES.md +5/−0
- puzzle-draw-cmdline.cabal +1/−17
- src/Diagrams/Puzzles/CmdLineSized.hs +0/−59
CHANGES.md view
@@ -1,3 +1,8 @@+0.1.0.2: 20140416+-----------------++* remove Diagrams.Puzzles.CmdLineSized, fixing windows build+ 0.1.0.1: 20140416 -----------------
puzzle-draw-cmdline.cabal view
@@ -1,5 +1,5 @@ name: puzzle-draw-cmdline-version: 0.1.0.1+version: 0.1.0.2 synopsis: Creating graphics for pencil puzzles, command line tools. description: Companion executable to puzzle-draw. Separate to keep the dependency on diagrams-cairo out of the library.@@ -18,22 +18,6 @@ flag cairo description: Build against Cairo backend default: False--library- -- Modules exported by the library.- if flag(cairo)- exposed-modules: Diagrams.Puzzles.CmdLineSized-- -- Other library packages from which modules are imported.- build-depends: base >= 4.2 && < 4.8,- diagrams-lib >= 1.0 && <= 1.2,- optparse-applicative >= 0.7 && < 0.9,- filepath >= 1.3 && < 1.4- if flag(cairo)- build-depends: diagrams-cairo >= 1.0 && < 1.2-- hs-source-dirs: src- ghc-options: -Wall executable drawpuzzle main-is: drawpuzzle.hs
− src/Diagrams/Puzzles/CmdLineSized.hs
@@ -1,59 +0,0 @@-{-# LANGUAGE TypeFamilies #-}--module Diagrams.Puzzles.CmdLineSized where--import Diagrams.Prelude hiding ((<>), option, value)-import Diagrams.Backend.Cairo-import Diagrams.Backend.Cairo.CmdLine ()-import Diagrams.Backend.CmdLine-import Diagrams.BoundingBox--import Data.Maybe (fromMaybe)--import System.FilePath (splitExtension)--import Options.Applicative--data SizedOpts = SizedOpts- { _scale :: Maybe Double- , _outp :: String- }--sizedOpts :: Parser SizedOpts-sizedOpts = SizedOpts- <$> (optional . option)- (long "scale" <> short 's'- <> metavar "FACTOR"- <> help "Desired scaling factor relative to default size")- <*> strOption- (long "output" <> short 'o'- <> metavar "FILE"- <> help "Desired output file")--instance Parseable SizedOpts where- parser = sizedOpts--cmtopoint :: Double -> Double-cmtopoint = (* 28.3464567)--newtype M = M (Diagram Cairo R2)--instance Mainable M where- type MainOpts M = SizedOpts-- mainRender opts (M x) = do- let w = fst . unr2 . boxExtents . boundingBox $ x- w' = fromMaybe 1 (_scale opts) * w- (_, ext) = splitExtension (_outp opts)- w'' = case ext of- ".png" -> round (40 * w')- _ -> round . cmtopoint $ w'- dopts = DiagramOpts (Just w'') Nothing (_outp opts)- lopts = DiagramLoopOpts False Nothing 0- mainRender (dopts, lopts) x--instance ToResult M where- type Args M = ()- type ResultOf M = M-- toResult d _ = d