Admin message

Due to a large amount of spam we do not allow new users to create repositories, they are "external" users. If you are a new user and want to create a repository, for example for forking GHC, open a new issue on ghc/ghc using the "get-verified" issue template

Make GHC generics capable of handling unboxed types
Currently, GHC generics will not accept any unboxed constructor arguments: ``` $ ghci GHCi, version 7.10.2: http://www.haskell.org/ghc/ :? for help λ> :set -XMagicHash -XDeriveGeneric λ> :m + GHC.Generics GHC.Exts λ> data IntHash = IntHash Int# deriving Generic <interactive>:4:38: Can't make a derived instance of ‘Generic IntHash’: IntHash must not have unlifted or polymorphic arguments In the data declaration for ‘IntHash’ ``` This makes GHC generics strictly less powerful than `deriving` clauses in some scenarios, as typeclasses like `Eq`, `Ord`, and `Show` are capable of special-casing certain unboxed types: ``` λ> :set -ddump-deriv λ> data IntHash = IntHash Int# deriving Show ==================== Derived instances ==================== Derived instances: instance GHC.Show.Show Ghci1.IntHash where GHC.Show.showsPrec a_a1OJ (Ghci1.IntHash b1_a1OK) = GHC.Show.showParen ((a_a1OJ GHC.Classes.>= 11)) ((GHC.Base..) (GHC.Show.showString "IntHash ") (GHC.Show.showsPrec 11 (GHC.Types.I# b1_a1OK))) GHC.Show.showList = GHC.Show.showList__ (GHC.Show.showsPrec 0) ``` As discussed on the GHC devs mailing list [previously](https://mail.haskell.org/pipermail/ghc-devs/2015-September/009895.html), Andres suggested adding new generic representation types to mark where `Int#`, `Char#`, etc. are used (suggesting the name `UInt` to represent `Int#`). <details><summary>Trac metadata</summary> | Trac field | Value | | ---------------------- | ----------------- | | Version | 7.10.2 | | Type | FeatureRequest | | TypeOfFailure | OtherFailure | | Priority | normal | | Resolution | Unresolved | | Component | Compiler | | Test case | | | Differential revisions | | | BlockedBy | | | Related | | | Blocking | | | CC | dreixel, kosmikus | | Operating system | | | Architecture | | </details> <!-- {"blocked_by":[],"summary":"Make GHC generics capable of handling unboxed types","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"OwnedBy","contents":"RyanGlScott"},"version":"7.10.2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":["dreixel","kosmikus"],"type":"FeatureRequest","description":"Currently, GHC generics will not accept any unboxed constructor arguments:\r\n\r\n{{{\r\n$ ghci\r\nGHCi, version 7.10.2: http://www.haskell.org/ghc/ :? for help\r\nλ> :set -XMagicHash -XDeriveGeneric\r\nλ> :m + GHC.Generics GHC.Exts\r\nλ> data IntHash = IntHash Int# deriving Generic\r\n\r\n<interactive>:4:38:\r\n Can't make a derived instance of ‘Generic IntHash’:\r\n IntHash must not have unlifted or polymorphic arguments\r\n In the data declaration for ‘IntHash’\r\n}}}\r\n\r\nThis makes GHC generics strictly less powerful than `deriving` clauses in some scenarios, as typeclasses like `Eq`, `Ord`, and `Show` are capable of special-casing certain unboxed types:\r\n\r\n{{{\r\nλ> :set -ddump-deriv\r\nλ> data IntHash = IntHash Int# deriving Show\r\n\r\n==================== Derived instances ====================\r\nDerived instances:\r\n instance GHC.Show.Show Ghci1.IntHash where\r\n GHC.Show.showsPrec a_a1OJ (Ghci1.IntHash b1_a1OK)\r\n = GHC.Show.showParen\r\n ((a_a1OJ GHC.Classes.>= 11))\r\n ((GHC.Base..)\r\n (GHC.Show.showString \"IntHash \")\r\n (GHC.Show.showsPrec 11 (GHC.Types.I# b1_a1OK)))\r\n GHC.Show.showList = GHC.Show.showList__ (GHC.Show.showsPrec 0)\r\n}}}\r\n\r\nAs discussed on the GHC devs mailing list [https://mail.haskell.org/pipermail/ghc-devs/2015-September/009895.html previously], Andres suggested adding new generic representation types to mark where `Int#`, `Char#`, etc. are used (suggesting the name `UInt` to represent `Int#`).","type_of_failure":"OtherFailure","blocking":[]} -->
issue