问题
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
?
回答1:
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
来源:https://stackoverflow.com/questions/35613612/how-can-i-get-ghci-to-use-my-show-function