packages feed

rainbox 0.10.0.0 → 0.10.0.2

raw patch · 20 files changed

+205/−358 lines, 20 filesdep +bytestringdep −barecheckdep ~QuickCheckdep ~rainbowPVP ok

version bump matches the API change (PVP)

Dependencies added: bytestring

Dependencies removed: barecheck

Dependency ranges changed: QuickCheck, rainbow

API changes (from Hackage documentation)

Files

lib/Rainbox/Box.hs view
@@ -105,7 +105,7 @@   , Width(..)   , unBox   )-import qualified System.IO as IO+import qualified Data.ByteString as BS  -- -- # Box making@@ -325,8 +325,8 @@   -> Box punctuateV bk a sep = B.catV bk a . intersperse sep --- | Convert a 'Box' to Rainbow 'Chunk's.  You can then print it--- using 'putChunks' or the like.+-- | Convert a 'Box' to Rainbow 'Chunk's.  You can then print it, as+-- described in "Rainbow". render :: Box -> [Chunk] render bx = case unBox bx of   B.NoHeight _ -> []@@ -339,14 +339,13 @@   where     toChunk = either spcToChunk id . B.unNibble     spcToChunk ss =-      fromText (X.replicate (B.numSpaces ss) (X.singleton ' '))+      chunkFromText (X.replicate (B.numSpaces ss) (X.singleton ' '))       <> back (B.spcBackground ss) --- | Prints a Box to standard output.  If standard output is not a--- terminal, no colors are used.  Otherwise, colors are used if your--- TERM environment variable suggests they are available.+-- | Prints a Box to standard output.  The highest number of available+-- colors are used, using 'byteStringMakerFromEnvironment' from+-- "Rainbow". printBox :: Box -> IO () printBox b = do-  t <- smartTermFromEnv IO.stdout-  hPutChunks IO.stdout t . render $ b-+  mkr <- byteStringMakerFromEnvironment+  mapM_ BS.putStr . chunksToByteStrings mkr . render $ b
lib/Rainbox/Box/Primitives.hs view
@@ -71,6 +71,7 @@  import qualified Data.Foldable as F import Rainbow+import Rainbow.Types import Data.Monoid import qualified Data.Text as X import Data.String@@ -194,7 +195,7 @@   width :: a -> Int  instance HasWidth Bar where-  width = sum . map (sum . map X.length . text) . unBar+  width = sum . map (sum . map X.length . chunkTexts) . unBar  instance HasWidth Box where   width b = case unBox b of@@ -204,7 +205,7 @@       x:_ -> width x  instance HasWidth Chunk where-  width = sum . map X.length . text+  width = sum . map X.length . chunkTexts  -- # Making Boxes @@ -507,7 +508,7 @@  -- | Drops the given number of characters from a Chunk. dropChunkChars :: Int -> Chunk -> Chunk-dropChunkChars n c = c { text = go n (text c) }+dropChunkChars n c = c { chunkTexts = go n (chunkTexts c) }   where     go nLeft ls = case ls of       [] -> []@@ -538,7 +539,7 @@                     Nibble . Right . takeChunkChars n $ chk)  takeChunkChars :: Int -> Chunk -> Chunk-takeChunkChars n c = c { text = go n (text c) }+takeChunkChars n c = c { chunkTexts = go n (chunkTexts c) }   where     go nLeft ls = case ls of       [] -> []
rainbox.cabal view
@@ -3,11 +3,11 @@ -- http://www.github.com/massysett/cartel -- -- Script name used to generate: genCabal.hs--- Generated on: 2015-02-17 16:40:53.4642 EST+-- Generated on: 2015-03-22 11:44:44.05559 EDT -- Cartel library version: 0.14.2.0  name: rainbox-version: 0.10.0.0+version: 0.10.0.2 cabal-version: >= 1.14 license: BSD3 license-file: LICENSE@@ -46,7 +46,8 @@     lib   build-depends:       base >= 4.5.0.0 && < 4.8.0.0-    , rainbow >= 0.20.4.0 && < 0.21+    , rainbow >= 0.22 && < 0.23+    , bytestring >= 0.10 && < 0.11     , text >= 0.11.3.1 && < 1.3.0.0     , transformers >= 0.3.0.0 && < 0.5.0.0     , array >= 0.4.0.0 && < 0.6.0.0@@ -62,17 +63,9 @@     Rainbox.Box.Primitives     Rainbox.Reader     Rainbox.Tutorial-    Rainbow.Coarbitrary-    Rainbow.Colors.Coarbitrary-    Rainbow.Colors.Generators-    Rainbow.Colors.Shrinkers-    Rainbow.Generators-    Rainbow.QuickCheck-    Rainbow.Shrinkers-    Rainbow.Types.Coarbitrary-    Rainbow.Types.Generators-    Rainbow.Types.Shrinkers+    Rainbow.Instances     Rainbox.Array2dTests+    Rainbox.Box.Instances     Rainbox.Box.PrimitivesTests     Rainbox.BoxDir     Rainbox.BoxTests@@ -88,14 +81,14 @@   default-language: Haskell2010   build-depends:       base >= 4.5.0.0 && < 4.8.0.0-    , rainbow >= 0.20.4.0 && < 0.21+    , rainbow >= 0.22 && < 0.23+    , bytestring >= 0.10 && < 0.11     , text >= 0.11.3.1 && < 1.3.0.0     , transformers >= 0.3.0.0 && < 0.5.0.0     , array >= 0.4.0.0 && < 0.6.0.0     , tasty >= 0.10.1 && < 0.11     , tasty-quickcheck >= 0.8.1 && < 0.9-    , QuickCheck >= 2.7.5 && < 2.8-    , barecheck >= 0.2.0.6 && < 0.3+    , QuickCheck >= 2.7 && < 2.9     , ChasingBottoms >= 1.3.0 && < 1.4  Executable rainbox-mosaic@@ -110,17 +103,9 @@       Rainbox.Box.Primitives       Rainbox.Reader       Rainbox.Tutorial-      Rainbow.Coarbitrary-      Rainbow.Colors.Coarbitrary-      Rainbow.Colors.Generators-      Rainbow.Colors.Shrinkers-      Rainbow.Generators-      Rainbow.QuickCheck-      Rainbow.Shrinkers-      Rainbow.Types.Coarbitrary-      Rainbow.Types.Generators-      Rainbow.Types.Shrinkers+      Rainbow.Instances       Rainbox.Array2dTests+      Rainbox.Box.Instances       Rainbox.Box.PrimitivesTests       Rainbox.BoxDir       Rainbox.BoxTests@@ -135,14 +120,14 @@     default-language: Haskell2010     build-depends:         base >= 4.5.0.0 && < 4.8.0.0-      , rainbow >= 0.20.4.0 && < 0.21+      , rainbow >= 0.22 && < 0.23+      , bytestring >= 0.10 && < 0.11       , text >= 0.11.3.1 && < 1.3.0.0       , transformers >= 0.3.0.0 && < 0.5.0.0       , array >= 0.4.0.0 && < 0.6.0.0       , tasty >= 0.10.1 && < 0.11       , tasty-quickcheck >= 0.8.1 && < 0.9-      , QuickCheck >= 2.7.5 && < 2.8-      , barecheck >= 0.2.0.6 && < 0.3+      , QuickCheck >= 2.7 && < 2.9       , ChasingBottoms >= 1.3.0 && < 1.4   else     buildable: False@@ -157,14 +142,14 @@   default-language: Haskell2010   build-depends:       base >= 4.5.0.0 && < 4.8.0.0-    , rainbow >= 0.20.4.0 && < 0.21+    , rainbow >= 0.22 && < 0.23+    , bytestring >= 0.10 && < 0.11     , text >= 0.11.3.1 && < 1.3.0.0     , transformers >= 0.3.0.0 && < 0.5.0.0     , array >= 0.4.0.0 && < 0.6.0.0     , tasty >= 0.10.1 && < 0.11     , tasty-quickcheck >= 0.8.1 && < 0.9-    , QuickCheck >= 2.7.5 && < 2.8-    , barecheck >= 0.2.0.6 && < 0.3+    , QuickCheck >= 2.7 && < 2.9     , ChasingBottoms >= 1.3.0 && < 1.4   main-is: rainbox-test.hs @@ -183,14 +168,14 @@     default-language: Haskell2010     build-depends:         base >= 4.5.0.0 && < 4.8.0.0-      , rainbow >= 0.20.4.0 && < 0.21+      , rainbow >= 0.22 && < 0.23+      , bytestring >= 0.10 && < 0.11       , text >= 0.11.3.1 && < 1.3.0.0       , transformers >= 0.3.0.0 && < 0.5.0.0       , array >= 0.4.0.0 && < 0.6.0.0       , tasty >= 0.10.1 && < 0.11       , tasty-quickcheck >= 0.8.1 && < 0.9-      , QuickCheck >= 2.7.5 && < 2.8-      , barecheck >= 0.2.0.6 && < 0.3+      , QuickCheck >= 2.7 && < 2.9       , ChasingBottoms >= 1.3.0 && < 1.4   else     buildable: False
− test/Rainbow/Coarbitrary.hs
@@ -1,7 +0,0 @@-module Rainbow.Coarbitrary-  ( module Rainbow.Types.Coarbitrary-  , module Rainbow.Colors.Coarbitrary-  ) where--import Rainbow.Types.Coarbitrary-import Rainbow.Colors.Coarbitrary
− test/Rainbow/Colors/Coarbitrary.hs
@@ -1,12 +0,0 @@-module Rainbow.Colors.Coarbitrary where--import Test.QuickCheck-import Rainbow.Colors-import Rainbow.Types.Coarbitrary-import qualified Prelude.Coarbitrary--radiant :: Radiant -> Gen b -> Gen b-radiant (Radiant c8 mc256) =-  color8 c8-  . Prelude.Coarbitrary.maybe color256 mc256-
− test/Rainbow/Colors/Generators.hs
@@ -1,11 +0,0 @@-module Rainbow.Colors.Generators where--import qualified Rainbow.Colors as C-import Test.QuickCheck-import qualified Rainbow.Types.Generators as G-import Control.Monad-import qualified Prelude.Generators--radiant :: Gen C.Radiant-radiant = liftM2 C.Radiant G.color8-  (Prelude.Generators.maybe G.color256)
− test/Rainbow/Colors/Shrinkers.hs
@@ -1,10 +0,0 @@-module Rainbow.Colors.Shrinkers where--import qualified Rainbow.Colors as C-import qualified Rainbow.Types.Shrinkers as S-import qualified Prelude.Shrinkers--radiant :: C.Radiant -> [C.Radiant]-radiant (C.Radiant c8 mc256) =-  zipWith C.Radiant (S.color8 c8)-    (Prelude.Shrinkers.maybe S.color256 mc256)
− test/Rainbow/Generators.hs
@@ -1,7 +0,0 @@-module Rainbow.Generators-  ( module Rainbow.Types.Generators-  , module Rainbow.Colors.Generators-  ) where--import Rainbow.Types.Generators-import Rainbow.Colors.Generators
+ test/Rainbow/Instances.hs view
@@ -0,0 +1,147 @@+{-# OPTIONS_GHC -fno-warn-orphans #-}+{-# LANGUAGE FlexibleInstances, DeriveGeneric, StandaloneDeriving #-}++-- | QuickCheck instances for all of Rainbow.  Currently Rainbow does+-- not use these instances itself; they are only here for+-- cut-and-paste for other libraries that may need them.  There is an+-- executable in Rainbow that is built solely to make sure this module+-- compiles without any errors.+--+-- To use these instances, just drop them into your own project+-- somewhere.  They are not packaged as a library because there are+-- orphan instances.++module Rainbow.Instances where++import Control.Applicative+import Test.QuickCheck+import Rainbow.Colors+import Rainbow.Types+import Data.Monoid+import Control.Monad+import qualified Data.Text as X++varInt :: Int -> Gen b -> Gen b+varInt = variant++instance Arbitrary Enum8 where+  arbitrary = elements [E0, E1, E2, E3, E4, E5, E6, E7]+  shrink = genericShrink++instance CoArbitrary Enum8 where+  coarbitrary x = case x of+    E0 -> varInt 0+    E1 -> varInt 1+    E2 -> varInt 2+    E3 -> varInt 3+    E4 -> varInt 4+    E5 -> varInt 5+    E6 -> varInt 6+    E7 -> varInt 7++instance Arbitrary Color8 where+  arbitrary = fmap Color8 arbitrary+  shrink = genericShrink++instance CoArbitrary Color8 where+  coarbitrary (Color8 Nothing) = varInt 0+  coarbitrary (Color8 (Just e)) = varInt 1 . coarbitrary e++instance Arbitrary Color256 where+  arbitrary = fmap Color256 arbitrary+  shrink = genericShrink++instance CoArbitrary Color256 where+  coarbitrary (Color256 Nothing) = varInt 0+  coarbitrary (Color256 (Just w)) = varInt 1 . coarbitrary w++instance Arbitrary (Last Color8) where+  arbitrary = fmap Last arbitrary++instance CoArbitrary (Last Color8) where+  coarbitrary (Last Nothing) = varInt 0+  coarbitrary (Last (Just c)) = varInt 1 . coarbitrary c++instance Arbitrary (Last Color256) where+  arbitrary = fmap Last arbitrary++instance CoArbitrary (Last Color256) where+  coarbitrary (Last Nothing) = varInt 0+  coarbitrary (Last (Just c)) = varInt 1 . coarbitrary c++instance Arbitrary (Last Bool) where+  arbitrary = fmap Last arbitrary++instance CoArbitrary (Last Bool) where+  coarbitrary (Last Nothing) = varInt 0+  coarbitrary (Last (Just b)) = varInt 1 . coarbitrary b++instance Arbitrary StyleCommon where+  arbitrary+    = StyleCommon <$> g <*> g <*> g <*> g <*> g <*> g <*> g <*> g+    where+      g = fmap Last arbitrary++instance CoArbitrary StyleCommon where+  coarbitrary (StyleCommon x0 x1 x2 x3 x4 x5 x6 x7)+    = coarbitrary x0+    . coarbitrary x1+    . coarbitrary x2+    . coarbitrary x3+    . coarbitrary x4+    . coarbitrary x5+    . coarbitrary x6+    . coarbitrary x7+    ++instance Arbitrary Style256 where+  arbitrary = liftM3 Style256 arbitrary arbitrary arbitrary++instance CoArbitrary Style256 where+  coarbitrary (Style256 x0 x1 x2)+    = coarbitrary x0+    . coarbitrary x1+    . coarbitrary x2++instance Arbitrary Style8 where+  arbitrary = liftM3 Style8 arbitrary arbitrary arbitrary++instance CoArbitrary Style8 where+  coarbitrary (Style8 x0 x1 x2)+    = coarbitrary x0+    . coarbitrary x1+    . coarbitrary x2++instance Arbitrary TextSpec where+  arbitrary = liftM2 TextSpec arbitrary arbitrary+  shrink = genericShrink++instance CoArbitrary TextSpec where+  coarbitrary (TextSpec x0 x1)+    = coarbitrary x0+    . coarbitrary x1++-- The Arbitrary instance for Text+-- is different from the one that comes from the Rainbow package++instance Arbitrary X.Text where+  arbitrary = fmap X.pack . listOf . elements $ ['0'..'Z']+  shrink = map X.pack . shrink . X.unpack++instance Arbitrary Chunk where+  arbitrary = liftM2 Chunk arbitrary+    (listOf (fmap X.pack (listOf (elements ['a'..'z']))))+  shrink = genericShrink++instance CoArbitrary Chunk where+  coarbitrary (Chunk ts txts) = coarbitrary ts+    . coarbitrary (map X.unpack txts)++instance Arbitrary Radiant where+  arbitrary = liftM2 Radiant arbitrary arbitrary+  shrink = genericShrink++instance CoArbitrary Radiant where+  coarbitrary (Radiant x0 x1)+    = coarbitrary x0+    . coarbitrary x1
− test/Rainbow/QuickCheck.hs
@@ -1,58 +0,0 @@-{-# OPTIONS_GHC -fno-warn-orphans #-}-{-# LANGUAGE FlexibleInstances #-}---- | QuickCheck instances for all of Rainbow.  Currently Rainbow does--- not use these instances itself; they are only here for--- cut-and-paste for other libraries that may need them.  There is an--- executable in Rainbow that is built solely to make sure this module--- compiles without any errors.------ To use these instances, just drop them into your own project--- somewhere.  They are not packaged as a library because there are--- orphan instances.--module Rainbow.QuickCheck where--import Test.QuickCheck-import Rainbow.Colors-import Rainbow.Types-import Data.Monoid-import Control.Monad-import qualified Data.Text as X--instance Arbitrary Enum8 where-  arbitrary = elements [E0, E1, E2, E3, E4, E5, E6, E7]--instance Arbitrary Color8 where-  arbitrary = fmap Color8 arbitrary--instance Arbitrary Color256 where-  arbitrary = fmap Color256 arbitrary--instance Arbitrary (Last Color8) where-  arbitrary = fmap Last arbitrary--instance Arbitrary (Last Color256) where-  arbitrary = fmap Last arbitrary--instance Arbitrary StyleCommon where-  arbitrary-    = liftM4 StyleCommon g g g g-    where-      g = fmap Last arbitrary--instance Arbitrary Style256 where-  arbitrary = liftM3 Style256 arbitrary arbitrary arbitrary--instance Arbitrary Style8 where-  arbitrary = liftM3 Style8 arbitrary arbitrary arbitrary--instance Arbitrary TextSpec where-  arbitrary = liftM2 TextSpec arbitrary arbitrary--instance Arbitrary Chunk where-  arbitrary = liftM2 Chunk arbitrary-    (listOf (fmap X.pack (listOf (elements ['a'..'z']))))--instance Arbitrary Radiant where-  arbitrary = liftM2 Radiant arbitrary arbitrary
− test/Rainbow/Shrinkers.hs
@@ -1,7 +0,0 @@-module Rainbow.Shrinkers-  ( module Rainbow.Types.Shrinkers-  , module Rainbow.Colors.Shrinkers-  ) where--import Rainbow.Types.Shrinkers-import Rainbow.Colors.Shrinkers
− test/Rainbow/Types/Coarbitrary.hs
@@ -1,55 +0,0 @@-module Rainbow.Types.Coarbitrary where--import Test.QuickCheck-import Data.Monoid.Coarbitrary-import Data.Text.Coarbitrary-import qualified Rainbow.Types as T-import Prelude hiding (last, maybe)-import Barecheck.Util-import Prelude.Coarbitrary--enum8 :: T.Enum8 -> Gen b -> Gen b-enum8 e = case e of-  T.E0 -> varInt 0-  T.E1 -> varInt 1-  T.E2 -> varInt 2-  T.E3 -> varInt 3-  T.E4 -> varInt 4-  T.E5 -> varInt 5-  T.E6 -> varInt 6-  T.E7 -> varInt 7--color8 :: T.Color8 -> Gen b -> Gen b-color8 (T.Color8 me) = maybe enum8 me--color256 :: T.Color256 -> Gen b -> Gen b-color256 (T.Color256 me) = maybe variant me--styleCommon :: T.StyleCommon -> Gen b -> Gen b-styleCommon c-  = last coarbitrary (T.scBold c)-  . last coarbitrary (T.scUnderline c)-  . last coarbitrary (T.scFlash c)-  . last coarbitrary (T.scInverse c)--style8 :: T.Style8 -> Gen b -> Gen b-style8 c-  = last color8 (T.foreground8 c)-  . last color8 (T.background8 c)-  . styleCommon (T.common8 c)--style256 :: T.Style256 -> Gen b -> Gen b-style256 c-  = last color256 (T.foreground256 c)-  . last color256 (T.background256 c)-  . styleCommon (T.common256 c)--textSpec :: T.TextSpec -> Gen b -> Gen b-textSpec c-  = style8 (T.style8 c)-  . style256 (T.style256 c)--chunk :: T.Chunk -> Gen b -> Gen b-chunk c-  = textSpec (T.textSpec c)-  . list text (T.text c)
− test/Rainbow/Types/Generators.hs
@@ -1,52 +0,0 @@-module Rainbow.Types.Generators where--import Data.Monoid.Generators-import qualified Rainbow.Types as T-import Test.QuickCheck-import Control.Monad-import Data.Text.Generators-import Prelude.Generators-import Prelude hiding (last, maybe)---enum8 :: Gen T.Enum8-enum8 = elements [minBound..maxBound]--color8 :: Gen T.Color8-color8 = fmap T.Color8 $ maybe enum8--color256 :: Gen T.Color256-color256 = fmap T.Color256 $ maybe (elements [minBound..maxBound])--background8 :: Gen T.Background8-background8 = last color8--background256 :: Gen T.Background256-background256 = last color256--foreground8 :: Gen T.Foreground8-foreground8 = last color8--foreground256 :: Gen T.Foreground256-foreground256 = last color256--styleCommon :: Gen T.StyleCommon-styleCommon = liftM4 T.StyleCommon g g g g-  where-    g = last arbitrary--style8 :: Gen T.Style8-style8 = liftM3 T.Style8 g g styleCommon-  where-    g = last color8--style256 :: Gen T.Style256-style256 = liftM3 T.Style256 g g styleCommon-  where-    g = last color256--textSpec :: Gen T.TextSpec-textSpec = liftM2 T.TextSpec style8 style256--chunk :: Gen T.Chunk-chunk = liftM2 T.Chunk textSpec (listOf (text arbitrary))
− test/Rainbow/Types/Shrinkers.hs
@@ -1,64 +0,0 @@-module Rainbow.Types.Shrinkers where--import Data.Text.Shrinkers-import Data.Monoid.Shrinkers-import Test.QuickCheck-  ( shrinkIntegral, shrink )---- be sure to import shrinkList from Test.QuickCheck.Arbitrary to--- maintain compatibility between QuickCheck 2.6 and 2.7-import Test.QuickCheck.Arbitrary ( shrinkList )-import qualified Rainbow.Types as T-import Prelude hiding (last)-import Prelude.Shrinkers--enum8 :: T.Enum8 -> [T.Enum8]-enum8 e = case e of-  T.E0 -> []-  T.E1 -> [T.E0]-  T.E2 -> [T.E0, T.E1]-  T.E3 -> [T.E0, T.E1, T.E2]-  T.E4 -> [T.E0, T.E1, T.E2, T.E3]-  T.E5 -> [T.E0, T.E1, T.E2, T.E3, T.E4]-  T.E6 -> [T.E0, T.E1, T.E2, T.E3, T.E4, T.E5]-  T.E7 -> [T.E0, T.E1, T.E2, T.E3, T.E4, T.E5, T.E6]--color8 :: T.Color8 -> [T.Color8]-color8 (T.Color8 me) = case me of-  Nothing -> []-  Just e -> map T.Color8 $ Nothing : map Just (enum8 e)--color256 :: T.Color256 -> [T.Color256]-color256 (T.Color256 me) = case me of-  Nothing -> []-  Just e -> map T.Color256 $ Nothing : map Just (shrinkIntegral e)--styleCommon :: T.StyleCommon -> [T.StyleCommon]-styleCommon (T.StyleCommon a b c d) =-  [ T.StyleCommon a' b' c' d'-    | (a', b', c', d') <- tuple4 s s s s (a, b, c, d) ]-  where-    s = last shrink--style8 :: T.Style8 -> [T.Style8]-style8 (T.Style8 f8 b8 c) =-  [ T.Style8 f8' b8' c'-  | (f8', b8', c') <- tuple3 sc sc styleCommon (f8, b8, c) ]-  where-    sc = last color8--style256 :: T.Style256 -> [T.Style256]-style256 (T.Style256 f256 b256 c) =-  [ T.Style256 f256' b256' c'-  | (f256', b256', c') <- tuple3 sc sc styleCommon (f256, b256, c) ]-  where-    sc = last color256--textSpec :: T.TextSpec -> [T.TextSpec]-textSpec (T.TextSpec s8 s256) =-  [ T.TextSpec s8' s256'-  | (s8', s256') <- tuple2 style8 style256 (s8, s256) ]--chunk :: T.Chunk -> [T.Chunk]-chunk (T.Chunk t xs) = [T.Chunk t' xs'-  | (t', xs') <- tuple2 textSpec (shrinkList (text shrink)) (t, xs) ]
+ test/Rainbox/Box/Instances.hs view
@@ -0,0 +1,5 @@+module Rainbox.Box.Instances where++import Rainbow.Instances ()+import Test.QuickCheck+
test/Rainbox/Box/PrimitivesTests.hs view
@@ -6,10 +6,10 @@ import Test.Tasty.QuickCheck (testProperty) import Test.QuickCheck import Rainbow+import Rainbow.Instances ()+import Rainbow.Types import qualified Data.Text as X-import qualified Rainbow.Generators as G import Rainbox.Box.Primitives-import Data.Monoid  genText :: Gen X.Text genText = fmap X.pack $ listOf c@@ -17,7 +17,7 @@     c = elements ['0'..'Z']  genChunk :: Gen Chunk-genChunk = G.chunk+genChunk = arbitrary  genHeight :: Gen Height genHeight = fmap Height $ frequency [(3, nonNeg), (1, neg)]@@ -33,7 +33,7 @@  -- | Generates blank Box. genBlankBox :: Gen Box-genBlankBox = liftM3 blank G.radiant rw cl+genBlankBox = liftM3 blank arbitrary rw cl   where     rw = fmap (Height . abs) arbitrarySizedIntegral     cl = fmap (Width . abs) arbitrarySizedIntegral@@ -45,7 +45,7 @@ -- | Generates a box using catH. genCatHBox :: Gen Box genCatHBox = sized $ \s -> do-  bk <- G.radiant+  bk <- arbitrary   av <- genAlignVert   bs <- listOf (resize (s `div` 2) genBox)   return $ catH bk av bs@@ -53,7 +53,7 @@ -- | Generates a box using catV. genCatVBox :: Gen Box genCatVBox = sized $ \s -> do-  bk <- G.radiant+  bk <- arbitrary   ah <- genAlignHoriz   bs <- listOf (resize (s `div` 2) genBox)   return $ catV bk ah bs@@ -65,7 +65,7 @@ genChunkLen :: Radiant -> Int -> Gen Chunk genChunkLen bk l = do   txt <- fmap X.pack $ vectorOf l (elements ['0'..'Z'])-  return $ (fromText txt) <> back bk+  return $ (chunkFromText txt) <> back bk  -- | Generates a box of text; its horizontal and vertical size -- depends on the size parameter.@@ -73,10 +73,10 @@ genTextBox = do   w <- fmap abs arbitrarySizedIntegral   h <- fmap abs arbitrarySizedIntegral-  bk <- G.radiant+  bk <- arbitrary   cks <- vectorOf h (genChunkLen bk w)   let bxs = map (chunks . (:[])) cks-  bk' <- G.radiant+  bk' <- arbitrary   return $ catV bk' left bxs  @@ -115,7 +115,7 @@ instance Arbitrary Inputs where   arbitrary = Inputs     <$> listOf genChunk-    <*> G.radiant+    <*> arbitrary     <*> genHeight     <*> genWidth     <*> genAlignVert@@ -151,7 +151,7 @@      , testProperty "makes Box with cols == number of characters" $ \i ->       let cks = iChunks i-          nChars = sum . map X.length . concat . map text $ cks+          nChars = sum . map X.length . concat . map chunkTexts $ cks       in (== nChars) . width $ chunks cks     ] 
test/Rainbox/BoxTests.hs view
@@ -5,7 +5,7 @@ import qualified Data.Text as X import Test.Tasty.QuickCheck (testProperty) import Test.Tasty-import Rainbow+import Rainbow.Types import Test.QuickCheck hiding (resize)  tests :: TestTree@@ -35,7 +35,7 @@       (== 1) . height . chunk . iChunk      , testProperty "makes Box as wide as characters in chunk" $ \i ->-      let cs = sum . map X.length . text . iChunk $ i+      let cs = sum . map X.length . chunkTexts . iChunk $ i       in (== cs) . width . chunk . iChunk $ i     ] 
test/Rainbox/Instances.hs view
@@ -6,7 +6,7 @@  import Control.Monad import Test.QuickCheck-import Rainbow.QuickCheck ()+import Rainbow.Instances () import Rainbox import Rainbox.Box 
test/Visual.hs view
@@ -5,13 +5,12 @@ import Control.Monad import Rainbox.Box import Rainbow-import Data.Monoid+import Test.QuickCheck hiding (resize) import Test.QuickCheck.Gen hiding (resize) import Test.QuickCheck.Random import Rainbox.Box.PrimitivesTests+import Rainbow.Instances () import Data.String-import Data.Word (Word8)-import qualified Rainbow.Colors.Generators as RG  colors = fore yellow <> back blue @@ -31,20 +30,16 @@  sizeParam = 7 -putBox b = do-  term <- termFromEnv-  putChunks term . render $ b- describe s b = do   putStrLn (s ++ ":")-  putBox b+  printBox b   putStrLn ""  testCompound :: String -> (Radiant -> [Box] -> Box) -> IO () testCompound d f = do   g <- newQCGen   let bxs = unGen (replicateM 5 genTextBox) g sizeParam -      bk = unGen RG.radiant g sizeParam+      bk = unGen arbitrary g sizeParam   describe d $ f bk bxs  testVert
test/rainbox-mosaic.hs view
@@ -8,11 +8,9 @@ import Rainbox.Box.PrimitivesTests import System.Environment import Rainbox.Box-import Rainbow  main :: IO () main = do   s:[] <- getArgs   bx <- generate (Test.QuickCheck.resize (read s) genBox)-  e <- termFromEnv-  putChunks e . render $ bx+  printBox bx