Unboxed sums documentation looks wrong
According to the documentation,
In the case of enumeration types (like
Bool
), the unboxed sum layout only has anInt32
field (i.e. the whole thing is represented by an integer).
This does not actually seem to be true.
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.
Trac metadata
Trac field | Value |
---|---|
Version | 8.2.2 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | high |
Resolution | Unresolved |
Component | Documentation |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |