On 13/11/06, Valentin Gjorgjioski <[EMAIL PROTECTED]> wrote:
I'm pretty new in Haskell, few days since I started learning it. I want
to debu my programs. I'm currently using WinHugs, and I prefer debugger
for this.

I tried googling and I found Hugs.Observer.

I like it how it works, but still I have one BIG problem with it. It
doesn't work well with floats.

Following example

import Hugs.Observe

ex8 :: [Float]
ex8 = (observe "after reverse" ) reverse  [10.0,7.0,3.0,0.0,4.0]

gives me

 >ex8
[4.0,0.0,3.0,7.0,10.0]

 >>>>>>> Observations <<<<<<

after reverse
   { \ ($-990871 : $-990888 : $-990905 : $-990922 : $-990939 : [])  ->
$-990939 : $-990922 : $-990905 : $-990888 : $-990871 : []
   }


First of all, I don't get this behaviour in Hugs 20050308 on Ubuntu.

Main> ex8
[4.0,0.0,3.0,7.0,10.0]

Observations <<<<<<

after reverse
 { \ (10.0 : 7.0 : 3.0 : 0.0 : 4.0 : [])  -> 4.0 : 0.0 : 3.0 : 7.0 : 10.0 : []
 }

and:
Main> ex8 `seq` ()
()

Observations <<<<<<

after reverse
 { \ (_ : _ : _ : _ : _ : [])  -> _ : _
 }

So it might just be the version which you have.

I think that the $<n> values are perhaps representations of
unevaluated thunks. Try it with a string, or something like ex =
(observe "after replicate") (replicate 3) (5+5) and see what you get
(should be a list with 3 elements that are all the same thunk). Also
try:

ex8 = foldr seq () xs `seq` (observe "after reverse" ) reverse xs
   where xs = [10.0,7.0,3.0,0.0,4.0]

to see if forcing the values in the list first causes any change in the output.

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

Reply via email to