Make GHC generics capable of handling unboxed types
authorRyanGlScott <ryan.gl.scott@gmail.com>
Sat, 3 Oct 2015 17:21:37 +0000 (19:21 +0200)
committerBen Gamari <ben@smart-cactus.org>
Sat, 3 Oct 2015 18:03:15 +0000 (20:03 +0200)
commit6cde981a8788b225819be28659caddc35b77972d
treef78cd8be5a0549a654e523345bbde48a80493120
parenta96f1acc59f425062e6192b4cd2a19e1ef987f4a
Make GHC generics capable of handling unboxed types

This adds a data family (`URec`) and six data family instances (`UAddr`,
`UChar`, `UDouble`, `UFloat`, `UInt`, and `UWord`) which a `deriving
Generic(1)` clause will generate if it sees `Addr#`, `Char#`, `Double#`,
`Float#`, `Int#`, or `Word#`, respectively. The programmer can then
provide instances for these data family instances to provide custom
implementations for unboxed types, similar to how derived `Eq`, `Ord`,
and `Show` instances currently special-case unboxed types.

Fixes #10868.

Test Plan: ./validate

Reviewers: goldfire, dreixel, bgamari, austin, hvr, kosmikus

Reviewed By: dreixel, kosmikus

Subscribers: simonpj, thomie

Differential Revision: https://phabricator.haskell.org/D1239

GHC Trac Issues: #10868
13 files changed:
compiler/prelude/PrelNames.hs
compiler/typecheck/TcGenGenerics.hs
docs/users_guide/7.12.1-notes.rst
docs/users_guide/glasgow_exts.rst
libraries/base/GHC/Generics.hs
libraries/base/changelog.md
testsuite/tests/generics/GEq/GEq1.hs
testsuite/tests/generics/GEq/GEq1.stdout
testsuite/tests/generics/GEq/GEq1A.hs
testsuite/tests/generics/GShow/GShow.hs
testsuite/tests/generics/GShow/GShow1.stdout
testsuite/tests/generics/GShow/Main.hs
testsuite/tests/generics/T8468.stderr