Skip to content

Instantly share code, notes, and snippets.

@willbasky
Last active January 17, 2018 05:30
Show Gist options
  • Save willbasky/4abdd5c13be34d5eef3f2c0302d0764e to your computer and use it in GitHub Desktop.
Save willbasky/4abdd5c13be34d5eef3f2c0302d0764e to your computer and use it in GitHub Desktop.
Color+pretty prints or cyrillic (and other unicode)
import Text.Show.Unicode
import IPPrint
import qualified Language.Haskell.HsColour as HsColour
import qualified Language.Haskell.HsColour.Colourise as HsColour
import qualified Language.Haskell.HsColour.Output as HsColour
myColourPrefs = HsColour.defaultColourPrefs { HsColour.conid = [HsColour.Foreground HsColour.Yellow, HsColour.Bold], HsColour.conop = [HsColour.Foreground HsColour.Yellow], HsColour.string = [HsColour.Foreground HsColour.Green], HsColour.char = [HsColour.Foreground HsColour.Cyan], HsColour.number = [HsColour.Foreground HsColour.Red, HsColour.Bold], HsColour.layout = [HsColour.Foreground HsColour.White], HsColour.keyglyph = [HsColour.Foreground HsColour.White] }
myPrint :: (Show a) => a -> IO (); myPrint = putStrLn . HsColour.hscolour (HsColour.TTYg HsColour.XTerm256Compatible) myColourPrefs False False "" False . pshow
-- Если вместо pshow добавить ushow тогда будет русский + цвет, но без прити принта.
-- Цветовой + прити принтс
:set -interactive-print=myPrint
:set prompt "\ESC[33mλ > \ESC[m"
-- Руский
-- :set -interactive-print=uprint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment