maybe Debug.Trace? like...

import Debug.Trace

t = foldr debugf 0 [1..10000]

f :: Int -> Int -> Int
f = (+)

-- same typesig as f
debugf :: Int -> Int -> Int
debugf x y | y `mod` 1000 == 0 = x + (trace (show y) y)
debugf x y = x + y
 
t.




Andrew Coppin <[EMAIL PROTECTED]> 
Sent by: [EMAIL PROTECTED]
11/28/2007 05:03 PM

To
haskell-cafe@haskell.org
cc

Subject
[Haskell-cafe] Progress indications






In a "normal" programming language, you might write something like this:

  for x = 1 to 1000000
    print x
    ...do slow complex stuff...
  next x

In Haskell, you're more likely to write something like

  result k = filter my_weird_condition $ map strange_conversion $ 
unfoldr ...

That means that when you try to process the result, lots of processing 
happens, and your program just appears to lock up until a result is 
produced. So, like, how do you make it so that some kind of progress 
information is output while it's working? (Aside from dunking everything 
into the IO monad and ruining all your beautiful abstractions.) There 
doesn't seem to be a clean solution to this one...

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe



---

This e-mail may contain confidential and/or privileged information. If you 
are not the intended recipient (or have received this e-mail in error) 
please notify the sender immediately and destroy this e-mail. Any 
unauthorized copying, disclosure or distribution of the material in this 
e-mail is strictly forbidden.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to