diff options
author | Alen <alen@dotfiles.xyz> | 2025-01-19 04:32:38 +0400 |
---|---|---|
committer | Alen <alen@dotfiles.xyz> | 2025-01-19 04:32:38 +0400 |
commit | fcc0450a0608f3dcf1aceebebec0af5319450fb0 (patch) | |
tree | 9d54631ec65655d73920e6aa885a7e9193ef0188 | |
parent | ac0d201aa3f2c3063213611d76979dfcb683c637 (diff) |
Update GHCI config
-rw-r--r-- | dot_ghc/ghci.conf | 41 |
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 |