Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get `ghci` to use my `show` function?

Let's say you want to use your own show function (for example, let show = take 1000 . Prelude.show). How can you allow ghci to use that for printing instead of the built in show?

like image 797
PyRulez Avatar asked Feb 24 '16 21:02

PyRulez


1 Answers

You can define your own interactive print function e.g:

module BetterPrint
betterPrint a = putStrLn (take 1000 $ show a)

then start ghci as

ghci -interactive-print=BetterPrint.betterPrint
like image 110
Lee Avatar answered Oct 21 '22 08:10

Lee