[jhc] bug with Integer?

John Meacham john at repetae.net
Tue Aug 11 13:05:33 EDT 2009


On Wed, Aug 12, 2009 at 12:11:49AM +1000, Mark Wotton wrote:
>
> On 11/08/2009, at 11:45 PM, John Meacham wrote:
>
>> On Fri, Aug 07, 2009 at 11:01:15PM +1000, Mark Wotton wrote:
>>> Does JHC support unbounded integers? I get different results from
>>>
>>> main = putStrLn $ show (2 * 7540113804746346428 * 2)
>>>
>>> in GHC and JHC...
>>
>> Yeah, the libraries that come with jhc currently don't have an  
>> arbitrary
>> precision integer library. This isn't so much an issue with jhc as the
>> libraries it ships with, as jhc itself is agnostic about such library
>> issues. Once a suitable Integer library gets written (either in pure
>> haskell, or as a binding to an external C library) then I will include
>> it.
>
> Is there a problem with GMP? Or is it just that the Integer support is  
> baked into the ghc runtime?

yeah, ghc is very tied to its implementation of Integer and it's not
portable to other compilers. I specifically didn't bake anything like
that into jhc's design, not only for aethetic reasons, but for certain
targets (like an embeded system) you might want to use an alternate base
that doesn't have Integer at all. I am not sure what the best option is
in general, so I don't want to actually build anything into jhc just
yet. I imagine we might eventually have a couple different
implementations people could experiment with before deciding on a good
default implementation. 

        John

-- 
John Meacham - ⑆repetae.net⑆john⑈ - http://notanumber.net/


More information about the jhc mailing list