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

Simon Peyton-Jones simonpj at microsoft.com
Mon Dec 17 11:35:21 CET 2012


I don't understand the problem clearly enough to help.  Can you give a concrete example?

Simon

| -----Original Message-----
| From: glasgow-haskell-users-bounces at haskell.org [mailto:glasgow-haskell-
| users-bounces at 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->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__)
| int2Word (I# i#) = W# (int2Word# i#)
| #else
| int2Word = fromIntegral
| #endif
| 
| {-# RULES "fromIntegral/Int->Word" fromIntegral = int2Word #-}
| 
| but that didn't work as some fromSmallInteger and integerToWord function
| calls got inserted before my rule had a chance to fire. Can anyone think
| of a workaround that would work with 7.4.2?
| 
| P.S. The reason I want this workaround is that some of my users are
| stuck on 7.4.2 and this regression is affecting them quite badly, making
| me want to try to fix it in my library.
| 
| Cheers,
| Johan
| 
| _______________________________________________
| Glasgow-haskell-users mailing list
| Glasgow-haskell-users at haskell.org
| http://www.haskell.org/mailman/listinfo/glasgow-haskell-users




More information about the Glasgow-haskell-users mailing list