Ticket #1311 (new feature request)
newtypes of unboxed types disallowed - documentation bug and/or feature request
| Reported by: | Isaac Dupree | Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | _|_ |
| Component: | Compiler | Version: | 6.6.1 |
| Keywords: | Cc: | ||
| Operating System: | Unknown/Multiple | Architecture: | Unknown/Multiple |
| Type of failure: | Difficulty: | Unknown | |
| Test Case: | Blocked By: | ||
| Blocking: | Related Tickets: |
Description
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)
