Fixes for issue 110 and 139

Hi, I have uploaded patches for issues 110 (http://code.google.com/p/yhc/issues/detail?id=110) and 139 (http://code.google.com/p/yhc/issues/detail?id=139). Can someone please check them. For issue 139 I heavily borrowed from the GHC code to implement some of the primitive functions for Floats and Doubles. Is that ok? Also can someone please explain to me how multiplication for floats and doubles is done. I can see the call to primIntMul for Integers but I haven't found anything for floats and doubles. Regards, Stephan Hoermann

Hi
I have uploaded patches for issues 110 and 77
Both look good, and should be applied. I currently don't have SSH access, so if someone else wants to download them and apply that would be fine. Otherwise I'll do it in a week and a half (when I am back in York - Tom, if you are around, post viva celebrations?)
Issue 139 (http://code.google.com/p/yhc/issues/detail?id=139). Can someone please check them.
For issue 139 I heavily borrowed from the GHC code to implement some of the primitive functions for Floats and Doubles. Is that ok?
Borrowing from GHC is fine, and probably the easiest thing to do. A couple of small points: 1) I see the line: +lobal_YHC'_Primitive''primDoubleIsIEEE a = unsafeJS "return false;" I'm going to assume that's missing a 'g'? Dimitry - does the Javascript stuff look right to you? 2) Can you add some pointer and acknowledgement to GHC, possibly saying which file in GHC you stole this stuff from. If it ever goes wrong in future, we can then go back and get them to fix it and steal their updated fixed :-) 3) Can you add a test suite item, just the example in the bug report, so we can make sure this doesn't go wrong and is well fixed.
Also can someone please explain to me how multiplication for floats and doubles is done. I can see the call to primIntMul for Integers but I haven't found anything for floats and doubles.
No idea, I'm afraid. Tom should know? Many thanks for taking the time to do these fixes, Neil

Hi,
As it comes to Core primitives.
Yes, there is a typo in the last line of the patch (lobal should be global)
===================================
hunk ./src/translator/js/lib/haskell/StdOverlay.hs 252
+global_YHC'_Primitive''primFloatIsIEEE a = unsafeJS "return false;"
+lobal_YHC'_Primitive''primDoubleIsIEEE a = unsafeJS "return false;"
+
===================================
This stuff looks OK for this moment. I am however working on some
standardization of Core primitives. See the ycextra repo on
code.haskell.org, and the following file in particular:
http://code.haskell.org/ycextra/csvprim/20080629.csv
This file was obtained from a Google Spreadsheet (I can share it with
anyone who needs) by exporting to CSV, and there is a program that
converts it into Haskell
(http://code.haskell.org/ycextra/csvprim/GenPrimTable.hs), and further
into common annotations (unfinished as of now):
http://code.haskell.org/ycextra/Yhc/Core/AnnotatePrims.hs
http://code.haskell.org/ycextra/Yhc/Core/Annotation.hs
At some moment in the future, we will need to review this "normal" set
of primitives together, and possibly include more (like these IEEE
primitives); for now I am just setting up the framework. Since now we
can generate Core using Hugs*, there is more than one front-end.
Thanks.
---------------------------
* this has not been widely anounced yet, but the patch is already in
the Hugs repo that makes its own Core output more consistent, and
there is the hugs2yc repo on code.haskell.org where the front-end
converting Hugs Core to Yhc Core is being developed.
On 7/3/08, Neil Mitchell
Hi
I have uploaded patches for issues 110 and 77
Both look good, and should be applied. I currently don't have SSH access, so if someone else wants to download them and apply that would be fine. Otherwise I'll do it in a week and a half (when I am back in York - Tom, if you are around, post viva celebrations?)
Issue 139 (http://code.google.com/p/yhc/issues/detail?id=139). Can someone please check them.
For issue 139 I heavily borrowed from the GHC code to implement some of the primitive functions for Floats and Doubles. Is that ok?
Borrowing from GHC is fine, and probably the easiest thing to do. A couple of small points:
1) I see the line: +lobal_YHC'_Primitive''primDoubleIsIEEE a = unsafeJS "return false;"
I'm going to assume that's missing a 'g'? Dimitry - does the Javascript stuff look right to you?
2) Can you add some pointer and acknowledgement to GHC, possibly saying which file in GHC you stole this stuff from. If it ever goes wrong in future, we can then go back and get them to fix it and steal their updated fixed :-)
3) Can you add a test suite item, just the example in the bug report, so we can make sure this doesn't go wrong and is well fixed.
Also can someone please explain to me how multiplication for floats and doubles is done. I can see the call to primIntMul for Integers but I haven't found anything for floats and doubles.
No idea, I'm afraid. Tom should know?
Many thanks for taking the time to do these fixes,
Neil
-- Dimitry Golubovsky Anywhere on the Web

Hi, Issue 139: I fixed the typo, added some comments acknowledging GHC's code and added some testcases. I added the testcases to tests/conformance98/float/show/Main.hs, since that seemed to be the most sensible place from what I could tell. However, the file labeled as broken. Stephan Neil Mitchell wrote:
Hi
I have uploaded patches for issues 110 and 77
Both look good, and should be applied. I currently don't have SSH access, so if someone else wants to download them and apply that would be fine. Otherwise I'll do it in a week and a half (when I am back in York - Tom, if you are around, post viva celebrations?)
Issue 139 (http://code.google.com/p/yhc/issues/detail?id=139). Can someone please check them.
For issue 139 I heavily borrowed from the GHC code to implement some of the primitive functions for Floats and Doubles. Is that ok?
Borrowing from GHC is fine, and probably the easiest thing to do. A couple of small points:
1) I see the line: +lobal_YHC'_Primitive''primDoubleIsIEEE a = unsafeJS "return false;"
I'm going to assume that's missing a 'g'? Dimitry - does the Javascript stuff look right to you?
2) Can you add some pointer and acknowledgement to GHC, possibly saying which file in GHC you stole this stuff from. If it ever goes wrong in future, we can then go back and get them to fix it and steal their updated fixed :-)
3) Can you add a test suite item, just the example in the bug report, so we can make sure this doesn't go wrong and is well fixed.
Also can someone please explain to me how multiplication for floats and doubles is done. I can see the call to primIntMul for Integers but I haven't found anything for floats and doubles.
No idea, I'm afraid. Tom should know?
Many thanks for taking the time to do these fixes,
Neil
participants (3)
-
Dimitry Golubovsky
-
Neil Mitchell
-
Stephan Hoermann