packages feed

hyper-extra 0.1.0.3 → 0.2.0.0

raw patch · 2 files changed

+41/−16 lines, 2 filesdep +QuickCheckdep ~basedep ~hyper

Dependencies added: QuickCheck

Dependency ranges changed: base, hyper

Files

hyper-extra.cabal view
@@ -1,5 +1,5 @@ Name:               hyper-extra-Version:            0.1.0.3+Version:            0.2.0.0 Synopsis:           Display instances for the HyperHaskell graphical Haskell interpreter Description:   This package is part of the /HyperHaskell/ project and provides@@ -12,9 +12,9 @@ License-file:       LICENSE Author:             Heinrich Apfelmus Maintainer:         Heinrich Apfelmus <apfelmus quantentunnel de>-Copyright:          (c) Heinrich Apfelmus 2016-2018+Copyright:          (c) Heinrich Apfelmus 2016-2020 -Cabal-version:      >= 1.8+Cabal-version:      >= 1.10 Build-type:         Simple  Source-repository head@@ -24,10 +24,13 @@  Library     hs-source-dirs:     src-    build-depends:      base           >= 4.6   && < 4.13-                        , text         >= 0.11  && < 1.3-                        , diagrams-lib >= 1.3   && < 1.5-                        , diagrams-svg >= 1.4   && < 1.5+    build-depends:      base           >= 4.6     && < 4.15+                        , text         >= 0.11    && < 1.3+                        , diagrams-lib >= 1.3     && < 1.5+                        , diagrams-svg >= 1.4     && < 1.5                         , svg-builder  == 0.1.*-                        , hyper        == 0.1.*+                        , QuickCheck   >= 2.3.0.2 && < 2.14+                        , hyper        >= 0.2     && < 0.3     exposed-modules:    Hyper.Extra+    default-language:   Haskell2010+
src/Hyper/Extra.hs view
@@ -2,22 +2,44 @@     -- * Synopsis     -- | Visual representation for various data types.     +    -- * SVG+    fromSvg,     -- * Diagrams     dia,++    -- * QuickCheck+    hyperCheck,     ) where  import Hyper -import qualified Data.Text        as T-import qualified Data.Text.Lazy   as TL+import qualified Data.Text        as Text+import qualified Data.Text.Lazy   as Text.Lazy -import Diagrams.Prelude-import Diagrams.Backend.SVG-import Graphics.Svg               as SVG+import           Diagrams.Prelude                   hiding (pre)+import           Diagrams.Backend.SVG+import qualified Graphics.Svg +import qualified Test.QuickCheck  as Q+ {------------------------------------------------------------------------------    Integration of the `diagrams-svg` and `svg-builder` packages+    Integration of the `svg-builder` and `diagrams-svg` spackages ------------------------------------------------------------------------------}+-- | Render a SVG document.+-- This assumes that the argument is indeed a complete SVG document,+-- i.e. an @<SVG>@ tag.s+fromSvg :: Graphics.Svg.Element -> Graphic+fromSvg = html . Text.Lazy.toStrict . Graphics.Svg.renderText++-- | Render a diagram via SVG. dia :: QDiagram SVG V2 Double Any -> Graphic-dia = html . TL.toStrict . SVG.renderText-    . renderDia SVG (SVGOptions (mkWidth 250) Nothing (T.pack "") [] True)+dia = fromSvg . renderDia SVG (SVGOptions (mkWidth 250) Nothing (Text.pack "") [] True)++{-----------------------------------------------------------------------------+    Integration of the `QuickCheck` package+------------------------------------------------------------------------------}+hyperCheck :: Q.Testable prop => prop -> IO Graphic+hyperCheck =+    fmap (pre . Q.output) . Q.quickCheckWithResult (Q.stdArgs{ Q.chatty = False })++pre s = html . Text.pack $ "<pre>" ++ s ++ "</pre>"