RE: Need workaround for lack of fromIntegral/Int-Word rules in 7.4.2

2012-12-18 Thread Simon Peyton-Jones
| Turns out that I need a larger example to trigger the bug. I can | reliable trigger it using the unordered-containers library. I won't bore | you with the details. The workaround I need is this: | | forall x. integerToWord (smallInteger x) = int2Word# x So why not just add that rule

RE: Need workaround for lack of fromIntegral/Int-Word rules in 7.4.2

2012-12-17 Thread Simon Peyton-Jones
I don't understand the problem clearly enough to help. Can you give a concrete example? Simon | -Original Message- | From: glasgow-haskell-users-boun...@haskell.org [mailto:glasgow-haskell- | users-boun...@haskell.org] On Behalf Of Johan Tibell | Sent: 14 December 2012 23:17 | To:

Re: Need workaround for lack of fromIntegral/Int-Word rules in 7.4.2

2012-12-17 Thread Johan Tibell
This compiles badly in 7.4.2: f :: Int - Word f = fromIntegral I need a workaround. On Mon, Dec 17, 2012 at 2:35 AM, Simon Peyton-Jones simo...@microsoft.com wrote: I don't understand the problem clearly enough to help. Can you give a concrete example? Simon | -Original

Re: Need workaround for lack of fromIntegral/Int-Word rules in 7.4.2

2012-12-17 Thread Daniel Fischer
On Montag, 17. Dezember 2012, 07:07:21, Johan Tibell wrote: This compiles badly in 7.4.2: f :: Int - Word f = fromIntegral I need a workaround. Mine produces (with optimisations, of course) Convert.f :: GHC.Types.Int - GHC.Word.Word [GblId, Arity=1, Caf=NoCafRefs, Str=DmdType

Re: Need workaround for lack of fromIntegral/Int-Word rules in 7.4.2

2012-12-17 Thread Johan Tibell
Hi, Turns out that I need a larger example to trigger the bug. I can reliable trigger it using the unordered-containers library. I won't bore you with the details. The workaround I need is this: forall x. integerToWord (smallInteger x) = int2Word# x

Need workaround for lack of fromIntegral/Int-Word rules in 7.4.2

2012-12-14 Thread Johan Tibell
I'm trying to work around the lack of some fromIntegral/Int-Word rules in 7.4.2. I tried something like: int2Word :: Int - Word #if defined(__GLASGOW_HASKELL__) int2Word (I# i#) = W# (int2Word# i#) #else int2Word = fromIntegral #endif {-# RULES fromIntegral/Int-Word fromIntegral = int2Word #-}