cvs commit: hugs98/lib/exts Word.hs

Alastair Reid reid@glass.cse.ogi.edu
Sat, 7 Apr 2001 11:36:34 -0700


reid        2001/04/07 11:36:33 PDT

  Modified files:
    lib/exts             Word.hs 
  Log:
  The enum instance for Word32 suffered from numeric overflow.
  That is, these expressions:
  
    [maxBound .. ] :: [Word32]
    [maxBound .. maxBound] :: [Word32]
  
  should both have length 1 but the length seemed to be closer to 2^32
  (I got bored before it got that far though).
  
  I'm not completely happy with my fix (it's a little clunky) but at
  least it works now.  (If I was a good Haggis, I'd go look at how GHC,
  NHC and HBC handle this.)
  
  The Int instance suffers from the same problem but, in that case, the
  correct behaviour (at least for the first example) is probably to
  raise an error or to give an infinite list (which it does) not to give
  a finite list.
  
  Revision  Changes    Path
  1.4       +26 -4     hugs98/lib/exts/Word.hs