packages feed

boxes 0.1.3 → 0.1.4

raw patch · 6 files changed

+131/−11 lines, 6 filesdep +QuickCheckdep ~basenew-uploader

Dependencies added: QuickCheck

Dependency ranges changed: base

Files

CHANGES view
@@ -1,3 +1,12 @@+0.1.4: January 14, 2014+  * Require Cabal >= 1.9.2+  * Require CPP+  * Only require OverloadedStrings for GHC+  * Fix imports to work with 7.10.1+  * Fix other imports to work with versions as far back as 7.0.1,+    but only because it was easy this time+  * Add testing framework skeletons for Cabal and Travis-CI.+ 0.1.2: August 23, 2011   * Export rows/cols. 
LICENSE view
@@ -1,7 +1,5 @@ Copyright (c) Brent Yorgey 2008 -All rights reserved.- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:@@ -13,6 +11,8 @@ 3. Neither the name of the author nor the names of other contributors    may be used to endorse or promote products derived from this software    without specific prior written permission.++All other rights are reserved.  THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ README.md view
@@ -0,0 +1,6 @@+# boxes+A pretty-printing library for laying out text in two dimensions, using a simple box model.++Hackage: https://hackage.haskell.org/package/boxes++GitHub: https://github.com/treeowl/boxes
Text/PrettyPrint/Boxes.hs view
@@ -1,4 +1,25 @@+{-# LANGUAGE CPP #-}+#ifndef MIN_VERSION_base+-- These are not precise, but allow the module to be built without cabal.+#if __GLASGOW_HASKELL__ >= 709+#define MIN_VERSION_base(major1,major2,minor) (((major1) <= 4) && ((major2) <= 8))+#elif __GLASGOW_HASKELL__ >= 707+#define MIN_VERSION_base(major1,major2,minor) (((major1) <= 4) && ((major2) <= 7))+#elif __GLASGOW_HASKELL__ >= 706+#define MIN_VERSION_base(major1,major2,minor) (((major1) <= 4) && ((major2) <= 6))+#else+#define MIN_VERSION_base(major1,major2,minor) 0+#endif+#endif++#ifdef __GLASGOW_HASKELL__+#define OVERLOADED_STRINGS 1+#endif++#ifdef OVERLOADED_STRINGS {-# LANGUAGE OverloadedStrings #-}+#endif+ ----------------------------------------------------------------------------- -- | -- Module      :  Text.PrettyPrint.Boxes@@ -14,9 +35,11 @@ ----------------------------------------------------------------------------- module Text.PrettyPrint.Boxes     ( -- * Constructing boxes-+#ifdef TESTING+      Box(Box, content)+#else       Box-+#endif     , nullBox     , emptyBox     , char@@ -40,8 +63,15 @@      -- * Alignment +#ifdef TESTING+    , Alignment(..)+#else     , Alignment+#endif +#ifdef TESTING+    , Content(..)+#endif     , left, right     , top, bottom     , center1, center2@@ -67,11 +97,24 @@      ) where -import Data.String+#if MIN_VERSION_base(4,8,0)+import Prelude hiding (Word)+#endif++#if MIN_VERSION_base(4,4,0)+import Data.String (words, unwords)+#else+import Data.List (words, unwords)+#endif++#ifdef OVERLOADED_STRINGS+import Data.String (IsString(..))+#endif+ import Control.Arrow ((***), first) import Data.List (foldl', intersperse) -import Data.List.Split+import Data.List.Split (chunksOf)  -- | The basic data type.  A box has a specified size and some sort of --   contents.@@ -81,9 +124,11 @@                }   deriving (Show) +#ifdef OVERLOADED_STRINGS -- | Convenient ability to use bare string literals as boxes. instance IsString Box where   fromString = text+#endif  -- | Data type for specifying the alignment of boxes. data Alignment = AlignFirst    -- ^ Align at the top/left.
+ Text/PrettyPrint/Tests.hs view
@@ -0,0 +1,46 @@+import Test.QuickCheck+import Text.PrettyPrint.Boxes++import Control.Monad+import System.Exit (exitFailure, exitSuccess)++instance Arbitrary Alignment where+  arbitrary = elements [ AlignFirst+                       , AlignCenter1+                       , AlignCenter2+                       , AlignLast+                       ]++instance Arbitrary Box where+  arbitrary = do+    (NonNegative r) <- arbitrary+    (NonNegative c) <- arbitrary+    liftM (Box r c) arbitrary++instance Arbitrary Content where+  arbitrary = oneof [ return Blank+                    , liftM Text arbitrary+                    , liftM Row arbitrary+                    , liftM Col arbitrary+                    , liftM3 SubBox arbitrary arbitrary arbitrary+                    ]++-- extensional equivalence for Boxes+b1 ==== b2 = render b1 == render b2++prop_render_text s = render (text s) == (s ++ "\n")++{-+TODO: Find a way to enable these tests without time and space+explosion.++--prop_empty_right_id b = b <> nullBox ==== b+--prop_empty_left_id b  = nullBox <> b ==== b+--prop_empty_top_id b   = nullBox // b ==== b+--prop_empty_bot_id b   = b // nullBox ==== b+-}++main = quickCheckResult prop_render_text >>= \result ->+          case result of+            Success{} -> exitSuccess+            _ -> exitFailure
boxes.cabal view
@@ -1,21 +1,35 @@ name:                boxes-version:             0.1.3+version:             0.1.4 synopsis:            2D text pretty-printing library description:         A pretty-printing library for laying out text in                      two dimensions, using a simple box model. category:            Text license:             BSD3 license-file:        LICENSE-extra-source-files:  CHANGES+extra-source-files:  CHANGES, README.md author:              Brent Yorgey-maintainer:          Eelis van der Weegen <boxes@contacts.eelis.net>+maintainer:          David Feuer <David.Feuer@gmail.com> build-type:          Simple-cabal-version:       >= 1.6+cabal-version:       >= 1.9.2+-- Minimum Cabal version supporting test suites  library   build-depends:     base >= 3 && < 5, split >=0.2 && <0.3   exposed-modules:   Text.PrettyPrint.Boxes+  extensions:        CPP+  if impl(ghc)+    extensions: OverloadedStrings +Test-Suite test-boxes+  type:              exitcode-stdio-1.0+  main-is:           Text/PrettyPrint/Tests.hs+  build-depends:     base >= 3 && < 5, split >=0.2 && <0.3, QuickCheck+  extensions:        CPP+  if impl(ghc)+     extensions: OverloadedStrings+  cpp-options:       -DTESTING+-- Export some internals so the tests can get at them+ source-repository head   type: git-  location: git://github.com/Eelis/boxes.git+  location: git://github.com/treeowl/boxes.git