blob: c376198574355561f1ffbd82cefc0f390fe2aa24 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
: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
|