packages feed

funnyprint 0.0.1 → 0.0.2

raw patch · 4 files changed

+83/−17 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ FunnyPrint: prompt :: String -> String -> String -> String
+ FunnyPrint: prompt2 :: String -> String -> String -> String

Files

README.md view
@@ -12,4 +12,14 @@ - UTF8 output - Simple indentation +### Customize GHCi prompt in right way++see `FunnyPrint.prompt` and `FunnyPrint.prompt2`.++***++#### TODO:++- replace `ipprint` with `stylish-haskell`+ [funnyprint]: https://github.com/Pitometsu/funnyprint
funnyprint.cabal view
@@ -3,7 +3,7 @@ -- see: https://github.com/sol/hpack  name:           funnyprint-version:        0.0.1+version:        0.0.2 synopsis:       funnyPrint function to colorize GHCi output. description:    see FunnyPrint.funnyPrint. category:       Text@@ -11,6 +11,7 @@ bug-reports:    https://github.com/Pitometsu/funnyprint/issues maintainer:     Yuriy Pitomets license:        MIT+license-file:   LICENSE.md build-type:     Simple cabal-version:  >= 1.10 
library/FunnyPrint.hs view
@@ -1,5 +1,7 @@ -- | funnyPrint function to colorize GHCi output. See @FunnyPrint.funnyPrint@.-module FunnyPrint ( funnyPrint ) where+module FunnyPrint ( funnyPrint+                  , prompt+                  , prompt2 ) where  import IPPrint ( pshow ) import Language.Haskell.HsColour.Output ( TerminalType(..) )@@ -11,9 +13,42 @@                                  , Output(TTYg)                                  , hscolour                                  )+import Language.Haskell.HsColour.ANSI ( highlightOnG+                                      , highlightOff ) +terminal :: TerminalType+terminal = XTerm256Compatible++black   :: Highlight+black   = Foreground Black++red     :: Highlight+red     = Foreground Red++green   :: Highlight+green   = Foreground Green++yellow  :: Highlight+yellow  = Foreground Yellow++blue    :: Highlight+blue    = Foreground Blue++-- magenta :: Highlight+-- magenta = Foreground Magenta++cyan    :: Highlight+cyan    = Foreground Cyan++-- white   :: Highlight+-- white   = Foreground White++bold    :: Highlight+bold    = Bold+ -- | Colorize GHCi. UTF8 support. Smart indentatntion. Use as @:set -interactive-print=funnyPrint@.-funnyPrint :: (Show a) => a -> IO ()+funnyPrint :: (Show a) => a -- ^ printed input+           -> IO () funnyPrint = putStrLn . colorize . con . pshow   where     con :: String -> String@@ -24,23 +59,42 @@       where         (str, rest):_  = reads li :: [(String, String)]         (chr, rest'):_ = reads li :: [(Char,   String)]-    prefs = TTYg XTerm256Compatible+    prefs = TTYg terminal     colorize = hscolour prefs colours False False "" False-    colours = defaultColourPrefs { conid    = [ yellow , bold ]+    colours = defaultColourPrefs { conid    = [ yellow, bold ]                                  , conop    = [ yellow ]                                  , string   = [ green ]                                  , char     = [ cyan ]-                                 , number   = [ red , bold ]+                                 , number   = [ red, bold ]                                  , layout   = [ black ]                                  , keyglyph = [ black ]                                  }-      where-        black   = Foreground Black-        red     = Foreground Red-        green   = Foreground Green-        yellow  = Foreground Yellow-        -- blue    = Foreground Blue-        magenta = Foreground Magenta-        cyan    = Foreground Cyan-        -- white   = Foreground White-        bold    = Bold++mark   :: Highlight -> String+mark h = highlightOnG terminal [h, bold]++-- | Prompt for GHCi.+prompt :: String -- ^ marker+       -> String -- ^ message+       -> String -- ^ separator+       -> String+prompt m t s = mark yellow+            ++ m+            ++ mark green+            ++ t+            ++ mark blue+            ++ s+            ++ highlightOff++-- | Second prompt for multiline GHCi.+prompt2 :: String -- ^ marker+        -> String -- ^ message+        -> String -- ^ separator+        -> String+prompt2 m t s = mark yellow+             ++ m+             ++ mark green+             ++ t+             ++ mark red+             ++ s+             ++ highlightOff
package.yaml view
@@ -32,6 +32,7 @@   - ipprint == 0.6   source-dirs: library license: MIT+license-file: LICENSE.md maintainer: Yuriy Pitomets name: funnyprint synopsis: funnyPrint function to colorize GHCi output.@@ -50,4 +51,4 @@     - -with-rtsopts=-N     main: Main.hs     source-dirs: test-suite-version: '0.0.1'+version: '0.0.2'