[Haskell-cafe] Haskell Debugging
Bernie Pope
bjpop at csse.unimelb.edu.au
Tue Nov 14 02:16:53 EST 2006
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.
More information about the Haskell-Cafe
mailing list