LoginSignup
0
0

More than 5 years have passed since last update.

Debug.Trace

Last updated at Posted at 2012-11-22

初学者に対して最初に教えるべきモジュールじゃなかろうか。(と言いつつ未だにまともにつかったことない)

% runghc
import Debug.Trace

add :: Int -> Int -> Int
add n m = (n, m) `traceShow` if n == 0
                             then m
                             else 1 + add (n - 1) m

main :: IO ()
main = do
  let str = show $ 3 `add` 2
  print $ if str == "5" then "true" else "false"

【実行結果】
(3,2)
(2,2)
(1,2)
(0,2)
"true"
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0