[GHC] #14752: Unboxed sums documentation looks wrong

GHC ghc-devs at haskell.org
Thu Feb 1 23:40:33 UTC 2018


#14752: Unboxed sums documentation looks wrong
-------------------------------------+-------------------------------------
           Reporter:  dfeuer         |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  high           |         Milestone:  8.4.2
          Component:  Documentation  |           Version:  8.2.2
           Keywords:  UnboxedSums    |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  Documentation
  Unknown/Multiple                   |  bug
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 According to the documentation,

 > In the case of enumeration types (like `Bool`), the unboxed sum layout
 only has an `Int32` field (i.e. the whole thing is represented by an
 integer).

 This does not actually seem to be true.

 {{{#!hs
 right :: Bool -> (# (# #) | Bool #)
 right x = (# | x #)

 test :: (# (# #) | Bool #) -> Bool
 test (# (# #) | #) = False
 test (# | _ #) -> True
 }}}

 If the documentation were correct, I would expect `test (right undefined)`
 to be `undefined`, but it is `True`.

 Either we should fix the documentation to match reality or the reality to
 match the documentation.

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


More information about the ghc-tickets mailing list