【发布时间】:2016-06-07 10:03:49
【问题描述】:
假设您想使用自己的显示功能(例如,let show = take 1000 . Prelude.show)。你怎么能允许ghci 使用它来打印而不是内置的show?
【问题讨论】:
标签: haskell ghc read-eval-print-loop ghci
假设您想使用自己的显示功能(例如,let show = take 1000 . Prelude.show)。你怎么能允许ghci 使用它来打印而不是内置的show?
【问题讨论】:
标签: haskell ghc read-eval-print-loop ghci
您可以定义自己的interactive print 函数,例如:
module BetterPrint
betterPrint a = putStrLn (take 1000 $ show a)
然后启动 ghci 为
ghci -interactive-print=BetterPrint.betterPrint
【讨论】:
ghci -interactive-print=BetterPrint.betterPrint 分配给别名。
:set -interactive-print=betterPrint