summary refs log tree commit diff
path: root/dot_ghc/ghci.conf
diff options
context:
space:
mode:
Diffstat (limited to 'dot_ghc/ghci.conf')
-rw-r--r--dot_ghc/ghci.conf41
1 files changed, 34 insertions, 7 deletions
diff --git a/dot_ghc/ghci.conf b/dot_ghc/ghci.conf
index 064d660..c376198 100644
--- a/dot_ghc/ghci.conf
+++ b/dot_ghc/ghci.conf
@@ -1,5 +1,7 @@
+:set -package pretty-show -package hscolour
+
 :set -XOverloadedStrings
-:set -XOverloadedLists
+-- :set -XOverloadedLists
 :set -XScopedTypeVariables
 :set -XPackageImports
 
@@ -9,13 +11,38 @@
 :set -ddump-deriv
 -- :set -fprint-explicit-foralls
 
--- Colour
-:set -package funnyprint
-:set -interactive-print=FunnyPrint.funnyPrintC
-:set prompt      "\ESC[1;32mλ: \ESC[m"
-:set prompt-cont "\ESC[1;32m : \ESC[m"
-
 -- useful extensions by default
 :set -XTypeApplications -XKindSignatures
 
+-- less repl noise
+:set -Wno-type-defaults
+
 import Prelude
+
+:{
+dotGHCI_myPrompt promptString ms _ = do
+  let main_module = head' [ m' | (m:m') <- ms, m == '*' ]
+  return $ concat [ "\ESC[33m\STX", main_module, "\ESC[0m\STX", promptString, " \ESC[0m\STX" ]
+  where
+    head' (x:_) = " \ESC[38;5;227m\STX" ++ x
+    head' _     = ""
+:}
+:set prompt-function dotGHCI_myPrompt "\ESC[32;1m\STXλ"
+:set prompt-cont-function dotGHCI_myPrompt "\ESC[32;1m\STX:"
+
+-- Colourise ghci output (use :nopretty to disable)
+-- Required libraries: pretty-show hscolour
+import qualified Language.Haskell.HsColour as HSC
+import qualified Language.Haskell.HsColour.Colourise as HSC
+:{
+dotGHCI_myPrint :: (Show a) => a -> IO ()
+dotGHCI_myPrint a = putStrLn $ HSC.hscolour HSC.TTY myColourPrefs False False "" False $ Text.Show.Pretty.ppShow a
+  where
+    myColourPrefs = HSC.defaultColourPrefs
+:}
+:seti -interactive-print dotGHCI_myPrint
+:def pretty \_ -> return ":set -interactive-print dotGHCI_myPrint"
+:def nopretty \_ -> return ":set -interactive-print System.IO.print"
+:pretty
+:module -Language.Haskell.HsColour
+:module -Language.Haskell.HsColour.Colourise