diff options
author | Ben Gamari <bgamari.foss@gmail.com> | 2016-03-30 21:58:24 +0200 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2016-03-30 22:49:06 +0200 |
commit | 24d761531cfc18152598becc0aeb90376fd19198 (patch) | |
tree | 93d6ee4f711c48f32d6fc6d45f2afb97cbc4275e /libraries | |
parent | bc953fcdbc76ffbb4f06a2b74be271268f73328f (diff) | |
download | haskell-24d761531cfc18152598becc0aeb90376fd19198.tar.gz |
Kill the magic of Any
This turns `Any` into a standard wired-in type family defined in
`GHC.Types`, instead its current incarnation as a magical creature
provided by the `GHC.Prim`. Also kill `AnyK`.
See #10886.
Test Plan: Validate
Reviewers: simonpj, goldfire, austin, hvr
Reviewed By: simonpj
Subscribers: goldfire, thomie
Differential Revision: https://phabricator.haskell.org/D2049
GHC Trac Issues: #10886
Diffstat (limited to 'libraries')
-rwxr-xr-x | libraries/base/GHC/Exts.hs | 3 | ||||
-rw-r--r-- | libraries/ghc-prim/GHC/Types.hs | 21 |
2 files changed, 23 insertions, 1 deletions
diff --git a/libraries/base/GHC/Exts.hs b/libraries/base/GHC/Exts.hs index 21f7bfd8b9..9e58f5c40c 100755 --- a/libraries/base/GHC/Exts.hs +++ b/libraries/base/GHC/Exts.hs @@ -74,6 +74,9 @@ module GHC.Exts -- * The Constraint kind Constraint, + -- * The Any type + Any, + -- * Overloaded lists IsList(..) ) where diff --git a/libraries/ghc-prim/GHC/Types.hs b/libraries/ghc-prim/GHC/Types.hs index 736ea3dbfa..827c3468ec 100644 --- a/libraries/ghc-prim/GHC/Types.hs +++ b/libraries/ghc-prim/GHC/Types.hs @@ -1,5 +1,6 @@ {-# LANGUAGE MagicHash, NoImplicitPrelude, TypeFamilies, UnboxedTuples, - MultiParamTypeClasses, RoleAnnotations, CPP, TypeOperators #-} + MultiParamTypeClasses, RoleAnnotations, CPP, TypeOperators, + PolyKinds #-} ----------------------------------------------------------------------------- -- | -- Module : GHC.Types @@ -29,6 +30,7 @@ module GHC.Types ( isTrue#, SPEC(..), Nat, Symbol, + Any, type (~~), Coercible, TYPE, RuntimeRep(..), Type, type (*), type (★), Constraint, -- The historical type * should ideally be written as @@ -81,6 +83,23 @@ data Symbol {- ********************************************************************* * * + Any +* * +********************************************************************* -} + +-- | The type constructor 'Any' is type to which you can unsafely coerce any +-- lifted type, and back. More concretely, for a lifted type @t@ and +-- value @x :: t@, -- @unsafeCoerce (unsafeCoerce x :: Any) :: t@ is equivalent +-- to @x@. +-- +type family Any :: k where { } +-- See Note [Any types] in TysWiredIn. Also, for a bit of history on Any see +-- #10886. Note that this must be a *closed* type family: we need to ensure +-- that this can't reduce to a `data` type for the results discussed in +-- Note [Any types]. + +{- ********************************************************************* +* * Lists NB: lists are built-in syntax, and hence not explicitly exported |