假设您想使用自己的显示函数(例如,let show = take 1000 . Prelude.show
)。你怎么可以允许ghci
使用它来代替内置的打印show
?
您可以定义自己的交互式打印 https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ghci.html#ghc-flag--interactive-print%20%E2%9F%A8expr%E2%9F%A9函数例如:
module BetterPrint
betterPrint a = putStrLn (take 1000 $ show a)
然后启动 ghci 作为
ghci -interactive-print=BetterPrint.betterPrint
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)