Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.33 KB | None | 0 0
  1. -- Colorizing ghci output
  2. import Text.Show.Pretty (ppShow)
  3. import qualified Language.Haskell.HsColour as HSC
  4. import qualified Language.Haskell.HsColour.Colourise as HSC
  5.  
  6. :{
  7. let myColourPrefs = HSC.defaultColourPrefs { HSC.conop = [HSC.Foreground HSC.Yellow]
  8. , HSC.conid = [HSC.Foreground HSC.Yellow, HSC.Bold]
  9. , HSC.string = [HSC.Foreground $ HSC.Rgb 29 193 57]
  10. , HSC.char = [HSC.Foreground HSC.Cyan]
  11. , HSC.number = [HSC.Foreground $ HSC.Rgb 202 170 236]
  12. , HSC.keyglyph = [HSC.Foreground HSC.Yellow]
  13. }
  14. :}
  15.  
  16. :{
  17. ghciColorPrint :: Show a => a -> IO ()
  18. ghciColorPrint = putStrLn . HSC.hscolour HSC.TTY myColourPrefs False False "" False . ppShow
  19. :}
  20.  
  21. :set -interactive-print=ghciColorPrint
  22.  
  23. -- green bold lambdas and multiline mode
  24. :set prompt "\ESC[94m\STX \ESC[m\STX"
  25. -- :set prompt "\ESC[1;32mλ: \ESC[m"
  26. :set prompt2 "\ESC[1;32mλ| \ESC[m"
  27. -- :set +m
  28.  
  29. :def package \ m -> return $ ":! ghc-pkg --simple-output find-module " ++ m
  30. :def no-pretty \_ -> return (":set -interactive-print=System.IO.print")
  31. :def rr \_ -> return ":script ~/.ghc/ghci.conf"
  32.  
  33. -- print the logo
  34. :module Text.Heredoc
  35. :set -XQuasiQuotes
  36. :{
  37. putStrLn [str| \ \\ \
  38. | \ \\ \
  39. | \ \\ \ _____________
  40. | \ \\ \\ \
  41. | \ \\ \\____________\
  42. | \ \\ \ _____________
  43. | / // \\ \
  44. | / // \\____________\
  45. | / // /\ \
  46. | / // / \ \
  47. | / // / \ \
  48. | /____//____/ \____\
  49. | _ _ _ _ _
  50. | | | | | | | | | |
  51. | | |__| | __ _ ___| | _____| | |
  52. | | __ |/ _` / __| |/ / _ \ | |
  53. | | | | | (_| \__ \ < __/ | |
  54. | |_| |_|\__,_|___/_|\_\___|_|_|
  55. |]
  56. :}
  57. :module - Text.Heredoc
  58. :set -XNoQuasiQuotes
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement