:set -package pretty-show -package hscolour :set -XOverloadedStrings -- :set -XOverloadedLists :set -XScopedTypeVariables :set -XPackageImports :set +t :set +m :set -ddump-deriv -- :set -fprint-explicit-foralls -- 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