[commit: ghc] master: Add Data instance for Const (3bd1dd4)

git at git.haskell.org git at git.haskell.org
Fri Nov 18 14:40:40 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/3bd1dd4d75fde3b922d4de08c16f29bdeb8e05d7/ghc

>---------------------------------------------------------------

commit 3bd1dd4d75fde3b922d4de08c16f29bdeb8e05d7
Author: Ryan Scott <ryan.gl.scott at gmail.com>
Date:   Fri Nov 18 09:33:01 2016 -0500

    Add Data instance for Const
    
    Summary:
    Fixes #12438. As discussed on the Haskell libraries mailing list here:
    https://mail.haskell.org/pipermail/libraries/2016-November/027396.html
    
    Reviewers: hvr, austin, bgamari
    
    Reviewed By: bgamari
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D2726
    
    GHC Trac Issues: #12438


>---------------------------------------------------------------

3bd1dd4d75fde3b922d4de08c16f29bdeb8e05d7
 libraries/base/Data/Data.hs                              | 4 ++++
 libraries/base/changelog.md                              | 2 ++
 testsuite/tests/annotations/should_fail/annfail10.stderr | 4 ++--
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/libraries/base/Data/Data.hs b/libraries/base/Data/Data.hs
index df37ab1..e43ec74 100644
--- a/libraries/base/Data/Data.hs
+++ b/libraries/base/Data/Data.hs
@@ -9,6 +9,7 @@
 {-# LANGUAGE ScopedTypeVariables #-}
 {-# LANGUAGE StandaloneDeriving #-}
 {-# LANGUAGE Trustworthy #-}
+{-# LANGUAGE TypeInType #-}
 {-# LANGUAGE TypeOperators #-}
 
 -----------------------------------------------------------------------------
@@ -1197,6 +1198,9 @@ deriving instance (Coercible a b, Data a, Data b) => Data (Coercion a b)
 -- | @since 4.9.0.0
 deriving instance Data a => Data (Identity a)
 
+-- | @since 4.10.0.0
+deriving instance (Typeable k, Data a, Typeable (b :: k)) => Data (Const a b)
+
 -- | @since 4.7.0.0
 deriving instance Data Version
 
diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md
index a01c878..dcc1719 100644
--- a/libraries/base/changelog.md
+++ b/libraries/base/changelog.md
@@ -26,6 +26,8 @@
   * Add `Semigroup` instance for `IO`, as well as for `Event` and `Lifetime`
     from `GHC.Event` (#12464)
 
+  * Add `Data` instance for `Const` (#12438)
+
 ## 4.9.0.0  *May 2016*
 
   * Bundled with GHC 8.0
diff --git a/testsuite/tests/annotations/should_fail/annfail10.stderr b/testsuite/tests/annotations/should_fail/annfail10.stderr
index 6e7732f..6a52a9c 100644
--- a/testsuite/tests/annotations/should_fail/annfail10.stderr
+++ b/testsuite/tests/annotations/should_fail/annfail10.stderr
@@ -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 39 instances involving out-of-scope types
+        ...plus 40 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 13 instances involving out-of-scope types
+        ...plus 14 instances involving out-of-scope types
         (use -fprint-potential-instances to see them all)
     • In the annotation: {-# ANN f 1 #-}



More information about the ghc-commits mailing list