Commit cbd49117 authored by Tao He's avatar Tao He Committed by Ben Gamari
Browse files

Make IntPtr and WordPtr as instance of Data.Data typeclass, fix #13115

Test Plan: ./validate

Reviewers: austin, hvr, bgamari, RyanGlScott

Reviewed By: RyanGlScott

Subscribers: RyanGlScott, rwbarton, thomie

GHC Trac Issues: #13115

Differential Revision: https://phabricator.haskell.org/D3938
parent e62391a7
......@@ -140,6 +140,8 @@ import GHC.Real -- So we can give Data instance for Ratio
--import GHC.IOBase -- So we can give Data instance for IO, Handle
import GHC.Ptr -- So we can give Data instance for Ptr
import GHC.ForeignPtr -- So we can give Data instance for ForeignPtr
import Foreign.Ptr (IntPtr(..), WordPtr(..))
-- So we can give Data instance for IntPtr and WordPtr
--import GHC.Stable -- So we can give Data instance for StablePtr
--import GHC.ST -- So we can give Data instance for ST
--import GHC.Conc -- So we can give Data instance for MVar & Co.
......@@ -1204,6 +1206,12 @@ instance Data a => Data (ForeignPtr a) where
dataTypeOf _ = mkNoRepType "GHC.ForeignPtr.ForeignPtr"
dataCast1 x = gcast1 x
-- | @since 4.11.0.0
deriving instance Data IntPtr
-- | @since 4.11.0.0
deriving instance Data WordPtr
------------------------------------------------------------------------------
-- The Data instance for Array preserves data abstraction at the cost of
-- inefficiency. We omit reflection services for the sake of data abstraction.
......
......@@ -30,6 +30,8 @@
* Add `iterate'`, a strict version of `iterate`, to `Data.List`
and `Data.OldList` (#3474)
* Add `Data` instances for `IntPtr` and `WordPtr` (#13115)
## 4.10.0.0 *April 2017*
* Bundled with GHC *TBA*
......
......@@ -10,7 +10,7 @@ annfail10.hs:9:1: error:
instance Data.Data.Data Ordering -- Defined in ‘Data.Data’
instance Data.Data.Data Integer -- Defined in ‘Data.Data’
...plus 15 others
...plus 43 instances involving out-of-scope types
...plus 45 instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the annotation: {-# ANN f 1 #-}
......@@ -23,6 +23,6 @@ annfail10.hs:9:11: error:
instance Num Double -- Defined in ‘GHC.Float’
instance Num Float -- Defined in ‘GHC.Float’
...plus two others
...plus 15 instances involving out-of-scope types
...plus 17 instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the annotation: {-# ANN f 1 #-}
......@@ -10,7 +10,7 @@ T12921.hs:4:1: error:
instance Data.Data.Data Ordering -- Defined in ‘Data.Data’
instance Data.Data.Data Integer -- Defined in ‘Data.Data’
...plus 15 others
...plus 43 instances involving out-of-scope types
...plus 45 instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the annotation:
{-# ANN module "HLint: ignore Reduce duplication" #-}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment