packages feed

rainbow 0.32.0.0 → 0.34.0.0

raw patch · 7 files changed

+46/−30 lines, 7 filesdep +lensdep −lens-simplePVP ok

version bump matches the API change (PVP)

Dependencies added: lens

Dependencies removed: lens-simple

API changes (from Hackage documentation)

- Rainbow.Types: back :: Functor f => (Color a -> f (Color a)) -> Style a -> f (Style a)
+ Rainbow.Types: back :: forall a_akB9. Lens' (Style a_akB9) (Color a_akB9)
- Rainbow.Types: blink :: Functor f => (Bool -> f Bool) -> Format -> f Format
+ Rainbow.Types: blink :: Lens' Format Bool
- Rainbow.Types: bold :: Functor f => (Bool -> f Bool) -> Format -> f Format
+ Rainbow.Types: bold :: Lens' Format Bool
- Rainbow.Types: color256 :: Functor f => (Color Word8 -> f (Color Word8)) -> Radiant -> f Radiant
+ Rainbow.Types: color256 :: Lens' Radiant (Color Word8)
- Rainbow.Types: color8 :: Functor f => (Color Enum8 -> f (Color Enum8)) -> Radiant -> f Radiant
+ Rainbow.Types: color8 :: Lens' Radiant (Color Enum8)
- Rainbow.Types: faint :: Functor f => (Bool -> f Bool) -> Format -> f Format
+ Rainbow.Types: faint :: Lens' Format Bool
- Rainbow.Types: fore :: Functor f => (Color a -> f (Color a)) -> Style a -> f (Style a)
+ Rainbow.Types: fore :: forall a_akB9. Lens' (Style a_akB9) (Color a_akB9)
- Rainbow.Types: format :: Functor f => (Format -> f Format) -> Style a -> f (Style a)
+ Rainbow.Types: format :: forall a_akB9. Lens' (Style a_akB9) Format
- Rainbow.Types: inverse :: Functor f => (Bool -> f Bool) -> Format -> f Format
+ Rainbow.Types: inverse :: Lens' Format Bool
- Rainbow.Types: invisible :: Functor f => (Bool -> f Bool) -> Format -> f Format
+ Rainbow.Types: invisible :: Lens' Format Bool
- Rainbow.Types: italic :: Functor f => (Bool -> f Bool) -> Format -> f Format
+ Rainbow.Types: italic :: Lens' Format Bool
- Rainbow.Types: scheme :: Functor f => (Scheme -> f Scheme) -> Chunk -> f Chunk
+ Rainbow.Types: scheme :: Lens' Chunk Scheme
- Rainbow.Types: strikeout :: Functor f => (Bool -> f Bool) -> Format -> f Format
+ Rainbow.Types: strikeout :: Lens' Format Bool
- Rainbow.Types: style256 :: Functor f => (Style Word8 -> f (Style Word8)) -> Scheme -> f Scheme
+ Rainbow.Types: style256 :: Lens' Scheme (Style Word8)
- Rainbow.Types: style8 :: Functor f => (Style Enum8 -> f (Style Enum8)) -> Scheme -> f Scheme
+ Rainbow.Types: style8 :: Lens' Scheme (Style Enum8)
- Rainbow.Types: underline :: Functor f => (Bool -> f Bool) -> Format -> f Format
+ Rainbow.Types: underline :: Lens' Format Bool
- Rainbow.Types: yarn :: Functor f => (Text -> f Text) -> Chunk -> f Chunk
+ Rainbow.Types: yarn :: Lens' Chunk Text

Files

lib/Rainbow.hs view
@@ -167,8 +167,8 @@ import qualified Rainbow.Types as Y import Data.Word (Word8) import Data.Function ((&))-import qualified Lens.Simple as Lens-import Lens.Simple ((.~))+import qualified Control.Lens as Lens+import Control.Lens ((.~)) import Data.Monoid (Monoid(mempty))  formatBoth :: Lens.Setter' Y.Format Bool -> Y.Chunk -> Y.Chunk
lib/Rainbow/Types.hs view
@@ -12,7 +12,7 @@  -- # Imports -import Lens.Simple (makeLenses)+import Control.Lens (makeLenses) import Data.String import Data.Text (Text) import qualified Data.Text as X
rainbow.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: a4425c1ecc287bdb359eb7e61890b889835d22f685b0da1e2379a4387dc5bb56+-- hash: 3d6f930a7b2c045e5eb1bb6169a5b9ad82753e1bfdc533cc56466aeccefb65de  name:           rainbow-version:        0.32.0.0+version:        0.34.0.0 synopsis:       Print text to terminal with colors and effects description:    Please see README.md category:       System@@ -42,7 +42,7 @@   build-depends:       base >=4.11 && <5     , bytestring-    , lens-simple+    , lens     , process     , text   default-language: Haskell2010@@ -65,7 +65,7 @@       QuickCheck     , base >=4.11 && <5     , bytestring-    , lens-simple+    , lens     , process     , text   default-language: Haskell2010@@ -88,7 +88,7 @@       QuickCheck     , base >=4.11 && <5     , bytestring-    , lens-simple+    , lens     , process     , text   default-language: Haskell2010@@ -111,7 +111,7 @@       QuickCheck     , base >=4.11 && <5     , bytestring-    , lens-simple+    , lens     , process     , text   default-language: Haskell2010@@ -134,7 +134,7 @@       QuickCheck     , base >=4.11 && <5     , bytestring-    , lens-simple+    , lens     , process     , text   default-language: Haskell2010
tests/Rainbow/QuickCheck.hs view
@@ -13,10 +13,20 @@  module Rainbow.QuickCheck where -import Test.QuickCheck-import Rainbow.Types+import qualified Data.Text as X import Data.Typeable+import Rainbow.Types+import Test.QuickCheck +instance Arbitrary X.Text where+  arbitrary = fmap X.pack $ listOf genChar+    where+      genChar = elements ['a'..'z']+  shrink = fmap X.pack . shrink . X.unpack++instance CoArbitrary X.Text where+  coarbitrary = coarbitrary . X.unpack+ instance (Typeable a, Arbitrary a) => Arbitrary (Color a) where   arbitrary = Color <$> arbitrary   shrink = genericShrink@@ -78,11 +88,11 @@   coarbitrary (Scheme a b) = coarbitrary a . coarbitrary b  -instance (Arbitrary a, Typeable a) => Arbitrary (Chunk a) where+instance Arbitrary Chunk where   arbitrary = Chunk <$> arbitrary <*> arbitrary   shrink = genericShrink -instance CoArbitrary a => CoArbitrary (Chunk a) where+instance CoArbitrary Chunk where   coarbitrary (Chunk a b)     = coarbitrary a     . coarbitrary b
tests/colorTest.hs view
@@ -1,8 +1,10 @@+{-# LANGUAGE OverloadedStrings #-} module Main where  import Rainbow import qualified Data.ByteString as BS import Data.Function ((&))+import qualified Data.Text as X  colors8 :: [(String, Radiant)] colors8 =@@ -23,39 +25,39 @@   where     mkColor w = (show w, color256 w) -colorChunks8ByForeground :: [[Chunk String]]+colorChunks8ByForeground :: [[Chunk]] colorChunks8ByForeground = do   (fgColorName, fgColor) <- colors8   (bgColorName, bgColor) <- colors8   let lbl = "foreground " <> fgColorName <> " background " <> bgColorName-  return [ chunk lbl & fore fgColor & back bgColor+  return [ chunk (X.pack lbl) & fore fgColor & back bgColor          , chunk "\n"          ] -colorChunks8ByBackground :: [[Chunk String]]+colorChunks8ByBackground :: [[Chunk]] colorChunks8ByBackground = do   (bgColorName, bgColor) <- colors8   (fgColorName, fgColor) <- colors8   let lbl = "background " <> bgColorName <> " foreground " <> fgColorName-  return [ chunk lbl & fore fgColor & back bgColor+  return [ chunk (X.pack lbl) & fore fgColor & back bgColor          , chunk "\n"          ] -colorChunks256ByForeground :: [[Chunk String]]+colorChunks256ByForeground :: [[Chunk]] colorChunks256ByForeground = do   (fgColorName, fgColor) <- colors256   (bgColorName, bgColor) <- colors256   let lbl = "foreground " <> fgColorName <> " background " <> bgColorName-  return [ chunk lbl & fore fgColor & back bgColor+  return [ chunk (X.pack lbl) & fore fgColor & back bgColor          , chunk "\n"          ] -colorChunks256ByBackground :: [[Chunk String]]+colorChunks256ByBackground :: [[Chunk]] colorChunks256ByBackground = do   (bgColorName, bgColor) <- colors256   (fgColorName, fgColor) <- colors256   let lbl = "background " <> bgColorName <> " foreground " <> fgColorName-  return [ chunk lbl & fore fgColor & back bgColor+  return [ chunk (X.pack lbl) & fore fgColor & back bgColor          , chunk "\n"          ] 
tests/test256color.hs view
@@ -1,11 +1,13 @@+{-# LANGUAGE OverloadedStrings #-} module Main where  import Control.Arrow (second) import Data.Function ((&)) import Rainbow import qualified Data.ByteString as BS+import qualified Data.Text as X -effects :: [(String, Chunk a -> Chunk a)]+effects :: [(String, Chunk -> Chunk)] effects =   [ ("bold", bold)   , ("faint", faint)@@ -22,7 +24,7 @@   where     mkColor w = (show w, color256 w) -maybeEffects :: [(String, Maybe (Chunk a -> Chunk a))]+maybeEffects :: [(String, Maybe (Chunk -> Chunk))] maybeEffects = ("(no effect)", Nothing)   : map (second Just) effects @@ -39,14 +41,14 @@                             ++ combinations' (n - 1) k' ys  -} -colorsAndEffects :: [[Chunk String]]+colorsAndEffects :: [[Chunk]] colorsAndEffects = do   (fgColorName, fgColor) <- colors   (bgColorName, bgColor) <- colors   (effectName, mayEffect) <- maybeEffects   let lbl = "foreground " ++ fgColorName ++ " background " ++ bgColorName           ++ " effect " ++ effectName-  return $ [ chunk lbl & fore fgColor+  return $ [ chunk (X.pack lbl) & fore fgColor              & back bgColor              & maybe id id mayEffect            , chunk "\n"
tests/test8color.hs view
@@ -1,11 +1,13 @@+{-# LANGUAGE OverloadedStrings #-} module Main where  import Control.Arrow (second) import Data.Function ((&)) import Rainbow import qualified Data.ByteString as BS+import qualified Data.Text as X -effects :: [(String, Chunk a -> Chunk a)]+effects :: [(String, Chunk -> Chunk)] effects =   [ ("bold", bold)   , ("faint", faint)@@ -30,7 +32,7 @@   , ("white", white)   ] -maybeEffects :: [(String, Maybe (Chunk a -> Chunk a))]+maybeEffects :: [(String, Maybe (Chunk -> Chunk))] maybeEffects = ("(no effect)", Nothing)   : map (second Just) effects @@ -47,14 +49,14 @@                             ++ combinations' (n - 1) k' ys  -} -colorsAndEffects :: [[Chunk String]]+colorsAndEffects :: [[Chunk]] colorsAndEffects = do   (fgColorName, fgColor) <- colors   (bgColorName, bgColor) <- colors   (effectName, mayEffect) <- maybeEffects   let lbl = "foreground " ++ fgColorName ++ " background " ++ bgColorName           ++ " effect " ++ effectName-  return $ [ chunk lbl & fore fgColor+  return $ [ chunk (X.pack lbl) & fore fgColor              & back bgColor              & maybe id id mayEffect            , chunk "\n"