[Haskell-cafe] Progress indications

Thomas Hartman thomas.hartman at db.com
Wed Nov 28 17:58:07 EST 2007

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

Andrew Coppin <andrewcoppin at btinternet.com> 
Sent by: haskell-cafe-bounces at haskell.org
11/28/2007 05:03 PM

haskell-cafe at haskell.org

[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 at haskell.org


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20071128/de297d54/attachment.htm

More information about the Haskell-Cafe mailing list