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 (perha

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 __

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=D

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

2012-12-17 Thread Johan Tibell
t; | -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: glasgow-haskell-users > | Subject: Need workaround for lack of fromIntegral/Int->W

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

2012-12-17 Thread Simon Peyton-Jones
| To: glasgow-haskell-users | Subject: Need workaround for lack of fromIntegral/Int->Word rules in | 7.4.2 | | 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__) | i

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 #