
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 : [] } Which is not useful. After that I try to install http://www.haskell.org/hat/ but for installing that I need hmake, and when I try to install hmake, I typed first configure -prefix, and then, make. cd src/hmake; make HC=ghc BUILDCOMP=ghc all config make[1]: Entering directory `/cygdrive/E/Haskell/hmake/src/hmake' Makefile:59: *** target pattern contains no `%'. Stop. make[1]: Leaving directory `/cygdrive/E/Haskell/hmake/src/hmake' make: *** [targets/ix86-CYGWIN_NT-5.1/hmake-ghc] Error 2 as you can see I'm using cygwin. I'm really stacked here, and I will kindly ask for help. Thanks, Valentin -- Valentin Gjorgjioski Bachelor of Computer Science Department of Knowledge Technologies, Jozef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia Phone: +386 1 477 3343 Fax: +386 1 477 3315 Web: http://kt.ijs.si/ValentinGjorgjioski/ Email: Valentin.Gjorgjioski@ijs.si

Hi Valentin Please, take a look at the Haskell Wiki page for debugging. http://haskell.org/haskellwiki/Debugging You will find that thanks to Neil Mitchell there is a Windows version of Hat available. Perhaps you can add your experiences with it if it works for you. pepe On 13/11/2006, at 16:32, Valentin Gjorgjioski 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 : [] }
Which is not useful. After that I try to install
but for installing that I need hmake, and when I try to install hmake, I typed first configure -prefix, and then, make.
cd src/hmake; make HC=ghc BUILDCOMP=ghc all config make[1]: Entering directory `/cygdrive/E/Haskell/hmake/src/hmake' Makefile:59: *** target pattern contains no `%'. Stop. make[1]: Leaving directory `/cygdrive/E/Haskell/hmake/src/hmake' make: *** [targets/ix86-CYGWIN_NT-5.1/hmake-ghc] Error 2
as you can see I'm using cygwin.
I'm really stacked here, and I will kindly ask for help.
Thanks, Valentin
-- Valentin Gjorgjioski Bachelor of Computer Science Department of Knowledge Technologies, Jozef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia Phone: +386 1 477 3343 Fax: +386 1 477 3315 Web: http://kt.ijs.si/ValentinGjorgjioski/ Email: Valentin.Gjorgjioski@ijs.si _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

On 13.11.2006 16:48 Pepe Iborra wrote:
Hi Valentin
Please, take a look at the Haskell Wiki page for debugging.
http://haskell.org/haskellwiki/Debugging
You will find that thanks to Neil Mitchell there is a Windows version of Hat available. Perhaps you can add your experiences with it if it works for you.
Oh silly me, I was looking that page, but I didn't notice this. Thanks a lot, pepe. I'll try, and I'll post feedback here. Valentin

On 13.11.2006 16:54 Valentin Gjorgjioski wrote:
On 13.11.2006 16:48 Pepe Iborra wrote:
Hi Valentin
Please, take a look at the Haskell Wiki page for debugging.
http://haskell.org/haskellwiki/Debugging
You will find that thanks to Neil Mitchell there is a Windows version of Hat available. Perhaps you can add your experiences with it if it works for you.
Oh silly me, I was looking that page, but I didn't notice this. Thanks a lot, pepe. I'll try, and I'll post feedback here.
I install it, I tried it, and it doesn't work for me. ./Hat/DML.hs:535:66: Ambiguous type variable `a' in the constraint: `Integral a' arising from use of `*^' at ./Hat/DML.hs:535:66-69 Probable fix: add a type signature that fixes these type variable(s) And this is line 535.... T.uapp2 p125v94v125v148 p125v147v125v147 p (+^) (*^) After that, I have in my code used operator ^, and I deleted that operator. Program finally compiled, but now, hat-observe reports me an error... this program has encountered a problem.... So, I will be really happy with something simple as Hugs.Observe if it works with floats. Some recommendation please? Valentin

Can you manage to compile GHC under Windows? Compiling GHC under Windows is known to be a bit tricky and time consuming, certainly not for the novice user, although the steps are well detailed in the GHC developer documentation. If so, I'd encourage you to play with the Ghci Debugger project. But beware, it is still in an experimental phase and there are some pending issues. If you want to try it I have set up the repository to point to the "last good known" version I have around. Just follow the instructions on how to get the patches in the wiki page. Otherwise, I'd advise you to stick to Debug.Trace and friends. Cheers pepe On 13/11/2006, at 17:29, Valentin Gjorgjioski wrote:
On 13.11.2006 16:54 Valentin Gjorgjioski wrote:
On 13.11.2006 16:48 Pepe Iborra wrote:
Hi Valentin
Please, take a look at the Haskell Wiki page for debugging.
http://haskell.org/haskellwiki/Debugging
You will find that thanks to Neil Mitchell there is a Windows version of Hat available. Perhaps you can add your experiences with it if it works for you.
Oh silly me, I was looking that page, but I didn't notice this. Thanks a lot, pepe. I'll try, and I'll post feedback here.
I install it, I tried it, and it doesn't work for me.
./Hat/DML.hs:535:66: Ambiguous type variable `a' in the constraint: `Integral a' arising from use of `*^' at ./Hat/DML.hs:535:66-69 Probable fix: add a type signature that fixes these type variable(s)
And this is line 535.... T.uapp2 p125v94v125v148 p125v147v125v147 p (+^) (*^)
After that, I have in my code used operator ^, and I deleted that operator. Program finally compiled, but now, hat-observe reports me an error... this program has encountered a problem....
So, I will be really happy with something simple as Hugs.Observe if it works with floats. Some recommendation please? Valentin _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

On 14/11/2006, at 3:29 AM, Valentin Gjorgjioski wrote:
On 13.11.2006 16:54 Valentin Gjorgjioski wrote:
On 13.11.2006 16:48 Pepe Iborra wrote:
Hi Valentin
Please, take a look at the Haskell Wiki page for debugging.
http://haskell.org/haskellwiki/Debugging
You will find that thanks to Neil Mitchell there is a Windows version of Hat available. Perhaps you can add your experiences with it if it works for you.
Oh silly me, I was looking that page, but I didn't notice this. Thanks a lot, pepe. I'll try, and I'll post feedback here.
I install it, I tried it, and it doesn't work for me.
./Hat/DML.hs:535:66: Ambiguous type variable `a' in the constraint: `Integral a' arising from use of `*^' at ./Hat/DML.hs:535:66-69 Probable fix: add a type signature that fixes these type variable(s)
And this is line 535.... T.uapp2 p125v94v125v148 p125v147v125v147 p (+^) (*^)
Okay, the type error you are getting is most likely caused by numeric defaulting, or lack of it in Hat. In Haskell, some instances of ambiguous overloading are resolved by the defaulting rules. See: http://haskell.org/onlinereport/decls.html#sect4.3.4 Hat is based on program transformation, and to cut a long story short, the defaulting rules do not work on the transformed program. So you must do the defaulting yourself by adding in explicit type annotations to the offending expression, then transform the program again. In your case it probably amounts to adding something like " :: Integer", or " :: Int" after the expression which uses (^). There is a note about this in the hat faq: http://www.cs.york.ac.uk/fp/hat/faq.html BTW the same problem happens in buddha, which is also based on program transformation. Cheers, Bernie.

On 13/11/06, Valentin Gjorgjioski
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

On 14.11.2006 23:17 Cale Gibbard wrote:
On 13/11/06, Valentin Gjorgjioski
wrote: 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 : [] } Just one more thing
If I write ex9 :: [Float] ex9 = (observe "after reverse" ) reverse [10.0,7.0,3.0,0.0,4.0] it doesn't work. If I delete ex9 :: [Float] then it works fine. any suggestions?

On 14/11/06, Valentin Gjorgjioski
Just one more thing
If I write
ex9 :: [Float] ex9 = (observe "after reverse" ) reverse [10.0,7.0,3.0,0.0,4.0]
it doesn't work. If I delete ex9 :: [Float] then it works fine. any suggestions?
This doesn't happen for me. The only thing I can think of trying is to check the type of ex9 by deleting the type signature, loading the file, and typing: :t ex9 on the hugs prompt. If it prints anything other than ex9 :: [Float] then you'll have your answer. - Cale

On 14/11/06, Cale Gibbard
On 14/11/06, Valentin Gjorgjioski
wrote: Just one more thing
If I write
ex9 :: [Float] ex9 = (observe "after reverse" ) reverse [10.0,7.0,3.0,0.0,4.0]
it doesn't work. If I delete ex9 :: [Float] then it works fine. any suggestions?
This doesn't happen for me. The only thing I can think of trying is to check the type of ex9 by deleting the type signature, loading the file, and typing: :t ex9 on the hugs prompt. If it prints anything other than ex9 :: [Float] then you'll have your answer.
- Cale
Sorry, I just realised what you meant, and I do get the behaviour you initially described without the typesignature there. Actually, without the typesignature, it's inferring the type [Double], due to defaulting. However, adding the typesignature ex9 :: [Double] will again cause it to print the values in the list rather than raw thunks. So perhaps it's because you haven't given a typesignature explicitly, so the list is initially polymorphic, which means that the values in it are actually function calls initially (that is, things like (fromRational 10.0)), and they only end up getting a specialised type later, when hugs finishes compiling the module and applies the monomorphism restriction and defaulting, but hugs isn't going back and optimising the function with the additional knowledge? I don't really know, that's my best guess at it. Maybe someone who knows hugs better would know with more certainty? - Cale

On Mon, Nov 13, 2006 at 04:32:34PM +0100, Valentin Gjorgjioski wrote:
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 : [] }
It's a Hugs bug (Float only, Double is fine). Now fixed in CVS.

On 15.11.2006 17:38 Ross Paterson wrote:
On Mon, Nov 13, 2006 at 04:32:34PM +0100, Valentin Gjorgjioski wrote:
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 : [] }
It's a Hugs bug (Float only, Double is fine). Now fixed in CVS.
Oh, thanks a lot. Nice to hear good news.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- Valentin Gjorgjioski Bachelor of Computer Science Department of Knowledge Technologies, Jozef Stefan Institute Jamova 39, SI-1000 Ljubljana, Slovenia Phone: +386 1 477 3343 Fax: +386 1 477 3315 Web: http://kt.ijs.si/ValentinGjorgjioski/ Email: Valentin.Gjorgjioski@ijs.si
participants (5)
-
Bernie Pope
-
Cale Gibbard
-
Pepe Iborra
-
Ross Paterson
-
Valentin Gjorgjioski