Re: [Haskell-cafe] Looking at program execution

2007-08-17 Thread Thomas Hartman
[EMAIL PROTECTED]:~cat test.hs
import Debug.Trace

foo = foldl (\first second -
  (trace ( first:  ++ ( show first) ) first)
  +
  (trace ( second:  ++ (show second) ) second) ) 0 [1,2,3]

bar = foldl (+)

traceIt x = trace (\nTraceIt:\n++show x++\n) x
[EMAIL PROTECTED]:~ghc -e foo test.hs
first: 0
second: 1
first: 1
second: 2
first: 3
second: 3
6
[EMAIL PROTECTED]:~

hope this helps.




Ian Duncan [EMAIL PROTECTED] 
Sent by: [EMAIL PROTECTED]
08/16/2007 08:20 PM

To
haskell-cafe@haskell.org
cc

Subject
[Haskell-cafe] Looking at program execution






Is there any way to view the steps that a haskell program goes 
through step by step?
I'm thinking something similar to what I've seen in things I've been 
reading. For example:
foldl (+) 0 [1..10]
= (0+1)
= ((0+1)+2)
= (((0+1)+2)+3)
= etc.
I've seen these sorts of line-by-line execution steps, but I was 
curious if there was any way to simply type in a function and its 
arguments and have ghci or hugs or something print out this sort of 
visual representation of what's going on. Anyone know of something 
like this?
___
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


Re: [Haskell-cafe] Looking at program execution

2007-08-17 Thread Thomas Hartman
or actually just...

[EMAIL PROTECTED]:~cat test.hs
import Debug.Trace

foo = foldl (\first second -
  trace ( ( show first) ++ (+) ++ (show second ) )
  ( first + second) ) 0 [1,2,3]

[EMAIL PROTECTED]:~ghc -e foo test.hs
0+1
1+2
3+3
6
[EMAIL PROTECTED]:~

is probably better




Thomas Hartman [EMAIL PROTECTED] 
Sent by: [EMAIL PROTECTED]
08/17/2007 10:52 AM

To
haskell-cafe@haskell.org, [EMAIL PROTECTED]
cc

Subject
Re: [Haskell-cafe] Looking at program execution







[EMAIL PROTECTED]:~cat test.hs 
import Debug.Trace 

foo = foldl (\first second - 
  (trace ( first:  ++ ( show first) ) first) 
  + 
  (trace ( second:  ++ (show second) ) second) ) 0 [1,2,3] 

bar = foldl (+) 

traceIt x = trace (\nTraceIt:\n++show x++\n) x 
[EMAIL PROTECTED]:~ghc -e foo test.hs 
first: 0 
second: 1 
first: 1 
second: 2 
first: 3 
second: 3 
6 
[EMAIL PROTECTED]:~ 

hope this helps. 



Ian Duncan [EMAIL PROTECTED] 
Sent by: [EMAIL PROTECTED] 
08/16/2007 08:20 PM 


To
haskell-cafe@haskell.org 
cc

Subject
[Haskell-cafe] Looking at program execution








Is there any way to view the steps that a haskell program goes 
through step by step?
I'm thinking something similar to what I've seen in things I've been 
reading. For example:
foldl (+) 0 [1..10]
= (0+1)
= ((0+1)+2)
= (((0+1)+2)+3)
= etc.
I've seen these sorts of line-by-line execution steps, but I was 
curious if there was any way to simply type in a function and its 
arguments and have ghci or hugs or something print out this sort of 
visual representation of what's going on. Anyone know of something 
like this?
___
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



---

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


Re: [Haskell-cafe] Looking at program execution

2007-08-16 Thread Brent Yorgey
On 8/16/07, Ian Duncan [EMAIL PROTECTED] wrote:

 Is there any way to view the steps that a haskell program goes
 through step by step?
 I'm thinking something similar to what I've seen in things I've been
 reading. For example:
 foldl (+) 0 [1..10]
 = (0+1)
 = ((0+1)+2)
 = (((0+1)+2)+3)
 = etc.
 I've seen these sorts of line-by-line execution steps, but I was
 curious if there was any way to simply type in a function and its
 arguments and have ghci or hugs or something print out this sort of
 visual representation of what's going on. Anyone know of something
 like this?


You probably want to check out Hat: http://www.haskell.org/hat/
I've only used it a bit myself but I think it provides some of the features
you're looking for.

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