[GHC] #9505: Bounded instance for Word (and possibly others) uses explicitly unboxed literals

GHC ghc-devs at haskell.org
Tue Nov 11 21:15:53 UTC 2014


#9505: Bounded instance for Word (and possibly others) uses explicitly unboxed
literals
-------------------------------------+-------------------------------------
              Reporter:  schyler     |            Owner:  ekmett
                  Type:  bug         |           Status:  new
              Priority:  normal      |        Milestone:
             Component:  Core        |          Version:  7.8.2
  Libraries                          |         Keywords:
            Resolution:              |     Architecture:  Unknown/Multiple
      Operating System:              |       Difficulty:  Unknown
  Unknown/Multiple                   |       Blocked By:
       Type of failure:              |  Related Tickets:
  None/Unknown                       |
             Test Case:              |
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------
Changes (by thomie):

 * cc: dfeuer, core-libraries-committee@… (added)
 * owner:   => ekmett
 * component:  Compiler => Core Libraries


Comment:

 For reference, from `libraries/base/GHC/Enum.hs`:
 {{{
 #!haskell
  instance Bounded Word where
      minBound = 0

      -- use unboxed literals for maxBound, because GHC doesn't optimise
      -- (fromInteger 0xffffffff :: Word).
  #if WORD_SIZE_IN_BITS == 32
      maxBound = W# (int2Word# 0xFFFFFFFF#)
  #elif WORD_SIZE_IN_BITS == 64
      maxBound = W# (int2Word# 0xFFFFFFFFFFFFFFFF#)
  #else
  #error Unhandled value for WORD_SIZE_IN_BITS
  #endif
 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9505#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list