Skip to content

newtypes of unboxed types disallowed - documentation bug and/or feature request

Tested in 6.6.1 and today's 6.7 (which claims to be version 6.7.20070418),

newtype FastBool = FastBool Int#

doesn't work. However this is not documented in the unboxed-types documentation in the User's Guide that lists similar restrictions http://www.haskell.org/ghc/docs/latest/html/users_guide/primitives.html

Similarly (maybe), in phantom type arguments, even in GADTs where kind inference could be at work

data Boo a where Boo :: Int# -> Boo Int#

doesn't work.

I tried newtype ( FastBool :: # ) = ... , and data Boo ( a :: # ) where... , which just confused GHC.

Is there a reason that coercions of unlifted types shouldn't work, or is it just unimplemented? (inspired by looking at GHC's compiler/utils/FastTypes.lhs and thinking that using newtypes instead of type synonyms in places like that would improve type-safety)

Trac metadata
Trac field Value
Version 6.6.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system Unknown
Architecture Unknown
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information