problems with trace

George Colpitts <[email protected]>
Newsgroups gmane.comp.lang.haskell.cafe
Message-ID <CAB-d4A62hAyag-E3YLW7da_nghfud+E9Nnebak955EN6oG3zcw@mail.gmail.com>
After I load the following into ghci and call main I expect to see "norm"
in the output 3 times as I have called it 3 times but it only shows once.
Why?

traceBug.hs
---------------
{-# OPTIONS_GHC -Wall #-}

import Debug.Trace (trace)

norm :: [Int] -> [Int]
norm  = trace ("norm") id

main :: IO ()
main =
  do
    print $ norm [2]
    print $ norm [2]
    print $ norm [3]
---------------------

ghci session

% ghci traceBug.hs
Loaded package environment from
/Users/gcolpitts/.ghc/x86_64-darwin-9.8.2/environments/default
GHCi, version 9.8.2: https://www.haskell.org/ghc/  :? for help
[1 of 2] Compiling Main             ( traceBug.hs, interpreted )
Ok, one module loaded.
ghci> main
norm
[2]
[2]
[3]
ghci>

_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.