[GHC] #1311: newtypes of unboxed types disallowed - documentation bug and/or feature request

GHC trac at galois.com
Mon Apr 30 01:32:43 EDT 2007


#1311: newtypes of unboxed types disallowed - documentation bug and/or feature
request
-----------------------------+----------------------------------------------
    Reporter:  Isaac Dupree  |        Owner:         
        Type:  bug           |       Status:  new    
    Priority:  normal        |    Milestone:         
   Component:  Compiler      |      Version:  6.6.1  
    Severity:  normal        |   Resolution:         
    Keywords:                |   Difficulty:  Unknown
          Os:  Unknown       |     Testcase:         
Architecture:  Unknown       |  
-----------------------------+----------------------------------------------
Comment (by brian at brianweb.net):

 I think `newtype FastBool = FastBool Int#` could potentially work. There
 are a bunch of places where the compiler assumes newtypes are lifted but
 that could be fixed. The newtype would have all the limitations of
 unlifted types though. You still couldn't use it in polymorphic functions
 or anything (which might be somewhat surprising to users of your code).
 Probably a better use of time would be to make SpecConstr turn enumeration
 types into `Int#`s, thus eliminating the need for FastBool altogether.

 As a side note, isn't FastBool kind of broken by design? You can't really
 do anything useful with it other than turning it back into a plain old
 Bool. `and#`/`or#` don't make sense as they must be strict in both of
 their arguments (which probably isn't what you want).

 The GADT example can't really work as you can't forall over unboxed
 tyvars. You can't write:

 `unBoo :: forall (a::#) . Boo a -> a`

 as `a` could have a completely different representation depending on how
 it was instantiated. You could probably make it so

 `unBoo :: Boo Int# -> Int#`

 would work but why not just write `BooInt = BooInt Int#` at that point.

 -Brian

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1311>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
-------------- next part --------------
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs at haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


More information about the Glasgow-haskell-bugs mailing list