packages feed

serokell-util 0.5.0 → 0.5.1

raw patch · 3 files changed

+24/−7 lines, 3 files

Files

serokell-util.cabal view
@@ -1,5 +1,5 @@ name:                serokell-util-version:             0.5.0+version:             0.5.1 synopsis:            General-purpose functions by Serokell homepage:            https://github.com/serokell/serokell-util license:             MIT
src/Serokell/Util/ANSI.hs view
@@ -4,18 +4,29 @@ module Serokell.Util.ANSI        ( Color(..)        , colorize+       , colorizeDull        , withColoredMessages        ) where -import           System.Console.ANSI (Color (..), ColorIntensity (Vivid),-                                      ConsoleLayer (Foreground), SGR (Reset, SetColor),-                                      setSGRCode)-import           Universum+import Universum +import System.Console.ANSI (Color (..), ConsoleLayer (Foreground), SGR (Reset, SetColor),+                            setSGRCode)++import qualified System.Console.ANSI as ANSI+ -- | Prettify 'Text' message with 'Vivid' color. colorize :: Color -> Text -> Text-colorize color msg =-    toText (setSGRCode [SetColor Foreground Vivid color]) <>+colorize = colorizeImpl ANSI.Vivid++-- | Colorize text using 'ANSI.Dull' palete (in contrast to 'colorize'+-- which uses 'ANSI.Vivid' palete)+colorizeDull :: Color -> Text -> Text+colorizeDull = colorizeImpl ANSI.Dull++colorizeImpl :: ANSI.ColorIntensity -> Color -> Text -> Text+colorizeImpl palete color msg =+    toText (setSGRCode [SetColor Foreground palete color]) <>     msg <>     toText (setSGRCode [Reset]) 
src/Serokell/Util/Lens.hs view
@@ -9,6 +9,7 @@        , _UnwrappedM        , zoom'        , magnify'+       , listL        ) where  import qualified Control.Lens               as L@@ -17,6 +18,7 @@ import           Control.Monad.State        (MonadState, State, StateT, get, runState,                                              state) import           Control.Monad.Trans.Except (ExceptT, mapExceptT)+import           GHC.Exts                   (IsList (..)) import           System.Wlog                (LoggerName, LoggerNameBox (..))  -- I don't know how to call these operators@@ -74,3 +76,7 @@     -> ReaderT t L.Identity a     -> m a magnify' l = reader . runReader . L.magnify l++-- | This isomorphism can be used to convert to or from an instance of 'IsList'.+listL :: IsList l => L.Iso' l [Item l]+listL = L.iso toList fromList