rainbow 0.28.0.4 → 0.30.0.0
raw patch · 3 files changed
+135/−144 lines, 3 filesdep ~QuickCheckdep ~basedep ~bytestring
Dependency ranges changed: QuickCheck, base, bytestring, lens-simple, process, text
Files
- lib/Rainbow/Types.hs +23/−14
- rainbow.cabal +112/−129
- tests/Rainbow/QuickCheck.hs +0/−1
lib/Rainbow/Types.hs view
@@ -13,7 +13,6 @@ -- # Imports import Lens.Simple (makeLenses)-import Data.Monoid ((<>)) import Data.Traversable () import Data.Typeable (Typeable) import Data.Word (Word8)@@ -31,13 +30,14 @@ deriving (Eq, Show, Ord, Generic, Typeable, Functor, Foldable, Traversable) +instance Semigroup (Color a) where+ Color x <> Color y = case y of+ Just a -> Color (Just a)+ _ -> Color x -- | Takes the last non-Nothing Color. 'mempty' is no color. instance Monoid (Color a) where mempty = Color Nothing- mappend (Color x) (Color y) = case y of- Just a -> Color (Just a)- _ -> Color x -- | A simple enumeration for eight values. Represents eight colors. data Enum8@@ -128,14 +128,15 @@ makeLenses ''Format +instance Semigroup Format where+ (Format x0 x1 x2 x3 x4 x5 x6 x7) <> (Format y0 y1 y2 y3 y4 y5 y6 y7)+ = Format (x0 || y0) (x1 || y1) (x2 || y2) (x3 || y3) (x4 || y4)+ (x5 || y5) (x6 || y6) (x7 || y7)+ -- | For each field, the resulting field is True if either field is -- True. For 'mempty', every field is False. instance Monoid Format where mempty = Format False False False False False False False False- mappend (Format x0 x1 x2 x3 x4 x5 x6 x7)- (Format y0 y1 y2 y3 y4 y5 y6 y7)- = Format (x0 || y0) (x1 || y1) (x2 || y2) (x3 || y3) (x4 || y4)- (x5 || y5) (x6 || y6) (x7 || y7) -- | The foreground and background color, and the 'Format'. This -- represents all colors and formatting attributes for either an 8- or@@ -149,11 +150,13 @@ makeLenses ''Style +instance Semigroup (Style a) where+ (Style x0 x1 x2) <> (Style y0 y1 y2)+ = Style (x0 <> y0) (x1 <> y1) (x2 <> y2)+ -- | Uses the underlying 'Monoid' instances for 'Color' and 'Format'. instance Monoid (Style a) where mempty = Style mempty mempty mempty- mappend (Style x0 x1 x2) (Style y0 y1 y2)- = Style (x0 <> y0) (x1 <> y1) (x2 <> y2) -- -- Scheme@@ -167,9 +170,11 @@ makeLenses ''Scheme +instance Semigroup Scheme where+ (Scheme x0 x1) <> (Scheme y0 y1) = Scheme (x0 <> y0) (x1 <> y1)+ instance Monoid Scheme where mempty = Scheme mempty mempty- mappend (Scheme x0 x1) (Scheme y0 y1) = Scheme (x0 <> y0) (x1 <> y1) -- -- Chunks@@ -187,6 +192,10 @@ } deriving (Eq, Show, Ord, Generic, Typeable, Functor, Foldable, Traversable) +instance Semigroup a => Semigroup (Chunk a) where+ (Chunk x0 x1) <> (Chunk y0 y1)+ = Chunk (x0 <> y0) (x1 <> y1)+ -- | Uses the underlying 'Monoid' instances for the 'Style' and for -- the particular '_yarn'. Therefore 'mempty' will have no formatting -- and no colors and will generally have no text, though whether or@@ -194,8 +203,6 @@ -- '_yarn'. instance Monoid a => Monoid (Chunk a) where mempty = Chunk mempty mempty- mappend (Chunk x0 x1) (Chunk y0 y1)- = Chunk (x0 <> y0) (x1 <> y1) -- | Creates a 'Chunk' with no formatting and with the given text. chunk :: a -> Chunk a@@ -211,13 +218,15 @@ , _color256 :: Color Word8 } deriving (Eq, Ord, Show, Typeable, Generic) +instance Semigroup Radiant where+ (Radiant x0 x1) <> (Radiant y0 y1) = Radiant (x0 <> y0) (x1 <> y1)+ -- | Uses the underlying 'Monoid' instance for the 'Color's. Thus the -- last non-'Nothing' 'Color' is used. This can be useful to specify -- one color for 8-color terminals and a different color for 256-color -- terminals. instance Monoid Radiant where mempty = Radiant mempty mempty- mappend (Radiant x0 x1) (Radiant y0 y1) = Radiant (x0 <> y0) (x1 <> y1) makeLenses ''Radiant
rainbow.cabal view
@@ -1,152 +1,135 @@--- This Cabal file generated using the Cartel library.--- Cartel is available at:--- http://www.github.com/massysett/cartel+-- This file has been generated from package.yaml by hpack version 0.20.0. ----- Script name used to generate: genCabal.hs--- Generated on: 2016-07-09 14:40:38.307841 EDT--- Cartel library version: 0.14.2.8--name: rainbow-version: 0.28.0.4-cabal-version: >= 1.10-license: BSD3-license-file: LICENSE-build-type: Simple-copyright: Copyright 2013-2015 Omari Norman-author: Omari Norman-maintainer: omari@smileystation.com-stability: Experimental-homepage: https://www.github.com/massysett/rainbow-bug-reports: https://www.github.com/massysett/rainbow/issues-synopsis: Print text to terminal with colors and effects-description:- rainbow helps you print Text chunks to a terminal with colors and effects- such as bold, underlining, etc. You pair each Text with a description- of how it should appear. Rainbow works with both 8-color and 256-color- terminals.-category: System-tested-with:- GHC == 7.10.1+-- see: https://github.com/sol/hpack+--+-- hash: 50c88c3a65d550f3d0b66b79d6ae10958845420bd4f5c6f03029673169adbfcb -Library- exposed-modules:- Rainbow- Rainbow.Translate- Rainbow.Types- default-language: Haskell2010- ghc-options:- -Wall- other-extensions:- TemplateHaskell- build-depends:- base >= 4.8 && < 5- , text >= 0.11.2.0- , bytestring >= 0.10- , process >= 1.2- , lens-simple >= 0.1.0- hs-source-dirs:- lib+name: rainbow+version: 0.30.0.0+synopsis: Print text to terminal with colors and effects+category: System+stability: Experimental+homepage: https://www.github.com/massysett/rainbow+bug-reports: https://www.github.com/massysett/rainbow/issues"+author: Omari Norman+maintainer: omari@smileystation.com+copyright: Copyright 2013-2018 Omari Norman+license: BSD3+license-file: LICENSE+build-type: Simple+cabal-version: >= 1.10 source-repository head type: git- location: https://github.com/massysett/rainbow.git+ location: https://github.com/massysett/rainbow -Test-Suite rainbow-instances- type: exitcode-stdio-1.0- main-is: rainbow-instances.hs- other-modules:- Rainbow.QuickCheck- Rainbow- Rainbow.Translate- Rainbow.Types+library hs-source-dirs:- tests+ lib+ other-extensions: TemplateHaskell+ ghc-options: -Wall build-depends:- QuickCheck >= 2.7+ base >=4.11 && <5+ , bytestring+ , lens-simple+ , process+ , text+ exposed-modules:+ Rainbow+ Rainbow.Translate+ Rainbow.Types+ other-modules:+ Paths_rainbow default-language: Haskell2010- ghc-options:- -Wall- other-extensions:- TemplateHaskell- build-depends:- base >= 4.8 && < 5- , text >= 0.11.2.0- , bytestring >= 0.10- , process >= 1.2- , lens-simple >= 0.1.0- hs-source-dirs:- lib -Test-Suite test8color+test-suite colorTest type: exitcode-stdio-1.0- main-is: test8color.hs- other-modules:- Rainbow- Rainbow.Translate- Rainbow.Types+ main-is: colorTest.hs hs-source-dirs:- tests- default-language: Haskell2010- ghc-options:- -Wall- other-extensions:- TemplateHaskell+ lib+ tests+ other-extensions: TemplateHaskell+ ghc-options: -Wall build-depends:- base >= 4.8 && < 5- , text >= 0.11.2.0- , bytestring >= 0.10- , process >= 1.2- , lens-simple >= 0.1.0+ QuickCheck+ , base >=4.11 && <5+ , bytestring+ , lens-simple+ , process+ , text+ other-modules:+ Rainbow+ Rainbow.Translate+ Rainbow.Types+ Rainbow.QuickCheck+ Paths_rainbow+ default-language: Haskell2010++test-suite rainbow-instances+ type: exitcode-stdio-1.0+ main-is: rainbow-instances.hs hs-source-dirs:- lib+ lib+ tests+ other-extensions: TemplateHaskell+ ghc-options: -Wall+ build-depends:+ QuickCheck+ , base >=4.11 && <5+ , bytestring+ , lens-simple+ , process+ , text+ other-modules:+ Rainbow+ Rainbow.Translate+ Rainbow.Types+ Rainbow.QuickCheck+ Paths_rainbow+ default-language: Haskell2010 -Test-Suite test256color+test-suite test256color type: exitcode-stdio-1.0 main-is: test256color.hs- other-modules:- Rainbow- Rainbow.Translate- Rainbow.Types hs-source-dirs:- tests- default-language: Haskell2010- ghc-options:- -Wall- other-extensions:- TemplateHaskell+ lib+ tests+ other-extensions: TemplateHaskell+ ghc-options: -Wall build-depends:- base >= 4.8 && < 5- , text >= 0.11.2.0- , bytestring >= 0.10- , process >= 1.2- , lens-simple >= 0.1.0- hs-source-dirs:- lib+ QuickCheck+ , base >=4.11 && <5+ , bytestring+ , lens-simple+ , process+ , text+ other-modules:+ Rainbow+ Rainbow.Translate+ Rainbow.Types+ Rainbow.QuickCheck+ Paths_rainbow+ default-language: Haskell2010 -Test-Suite colorTest+test-suite test8color type: exitcode-stdio-1.0- main-is: colorTest.hs- other-modules:- Rainbow- Rainbow.Translate- Rainbow.Types+ main-is: test8color.hs hs-source-dirs:- tests- default-language: Haskell2010- ghc-options:- -Wall- other-extensions:- TemplateHaskell+ lib+ tests+ other-extensions: TemplateHaskell+ ghc-options: -Wall build-depends:- base >= 4.8 && < 5- , text >= 0.11.2.0- , bytestring >= 0.10- , process >= 1.2- , lens-simple >= 0.1.0- hs-source-dirs:- lib--Flag visual- description: builds visual tests- default: False- manual: True+ QuickCheck+ , base >=4.11 && <5+ , bytestring+ , lens-simple+ , process+ , text+ other-modules:+ Rainbow+ Rainbow.Translate+ Rainbow.Types+ Rainbow.QuickCheck+ Paths_rainbow+ default-language: Haskell2010
tests/Rainbow/QuickCheck.hs view
@@ -13,7 +13,6 @@ module Rainbow.QuickCheck where -import Control.Applicative import Test.QuickCheck import Rainbow.Types import Data.Typeable