Int has a tight loop for `EnumFromTo` http://git.haskell.org/packages/base.git/blob/HEAD:/GHC/Enum.lhs#l500 On the other hand look at `EnumFromTo` for word32 http://hackage.haskell.org/package/base-4.7.0.0/docs/src/GHC-Word.html#Word3... It calls `integralEnumFromTo` Which is 723<http://git.haskell.org/packages/base.git/blob/52c0b09036c36f1ed928663abb2f295fd36a88bb:/GHC/Real.lhs#l723>integralEnumFromTo :: Integral a => a -> a -> [a] 724<http://git.haskell.org/packages/base.git/blob/52c0b09036c36f1ed928663abb2f295fd36a88bb:/GHC/Real.lhs#l724>integralEnumFromTo n m = map fromInteger [toInteger n .. toInteger m] That is right you get converted to an Integer, then back again. http://git.haskell.org/packages/base.git/blob/52c0b09036c36f1ed928663abb2f29... This seems to be the problem with all loops that use `Word32` and `EnumFromTo`. It looks like you could add a better `EnumFromTo` for `Word32` and you would close the gap between the loops that are using `EnumFromTo` and those that are not. Patrick On Tue, Apr 29, 2014 at 11:35 AM, Niklas Hambüchen <mail@nh2.me> wrote:
Interestingly, the discrimination against Word32 does not end here:
When compiling with -fllvm ( http://htmlpreview.github.io/?https://github.com/nh2/loop/blob/master/result... ), we can see that the forLoop + strict State monad is completely compiled away to a no-op for Int, but not for Word32. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- Patrick Wheeler Patrick.John.Wheeler@gmail.com Patrick.J.Wheeler@rice.edu Patrick.Wheeler@colorado.edu