summaryrefslogtreecommitdiff
path: root/libraries/base/include
diff options
context:
space:
mode:
authorHerbert Valerio Riedel <hvr@gnu.org>2013-09-15 23:49:32 +0200
committerHerbert Valerio Riedel <hvr@gnu.org>2013-09-17 10:41:44 +0200
commit8f9f1009b89a54bcab8354a255f1372803f780ce (patch)
tree3a70900a5917328421472111aae401d832a6c2ae /libraries/base/include
parent0f5eae0232a86ec57d841a83e6929361e2751270 (diff)
downloadhaskell-8f9f1009b89a54bcab8354a255f1372803f780ce.tar.gz
Make `<Typeable.h>` obsolete and refactor away its use
With GHC 7.8's PolyKinds the macros in `<Typeable.h>` are no longer of any use, and their use is clearly obsolete. The sites using those macros are replaced by auto-derivations of `Typeable` instances. This reduces reliance on the CPP extension and the compile dependency on `Typeable.h` in a couple of modules. Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
Diffstat (limited to 'libraries/base/include')
-rw-r--r--libraries/base/include/CTypes.h24
-rw-r--r--libraries/base/include/Typeable.h2
2 files changed, 11 insertions, 15 deletions
diff --git a/libraries/base/include/CTypes.h b/libraries/base/include/CTypes.h
index a33d1faab5..77b738c955 100644
--- a/libraries/base/include/CTypes.h
+++ b/libraries/base/include/CTypes.h
@@ -8,8 +8,6 @@
#ifndef CTYPES__H
#define CTYPES__H
-#include "Typeable.h"
-
{-
// As long as there is no automatic derivation of classes for newtypes we resort
// to extremely dirty cpp-hackery. :-P Some care has to be taken when the
@@ -18,33 +16,29 @@
-- // GHC can derive any class for a newtype, so we make use of that here...
-#define ARITHMETIC_CLASSES Eq,Ord,Num,Enum,Storable,Real
+#define ARITHMETIC_CLASSES Eq,Ord,Num,Enum,Storable,Real,Typeable
#define INTEGRAL_CLASSES Bounded,Integral,Bits
#define FLOATING_CLASSES Fractional,Floating,RealFrac,RealFloat
-#define ARITHMETIC_TYPE(T,C,S,B) \
+#define ARITHMETIC_TYPE(T,B) \
newtype T = T B deriving (ARITHMETIC_CLASSES); \
INSTANCE_READ(T,B); \
-INSTANCE_SHOW(T,B); \
-INSTANCE_TYPEABLE0(T,C,S) ;
+INSTANCE_SHOW(T,B);
-#define INTEGRAL_TYPE(T,C,S,B) \
+#define INTEGRAL_TYPE(T,B) \
newtype T = T B deriving (ARITHMETIC_CLASSES, INTEGRAL_CLASSES); \
INSTANCE_READ(T,B); \
-INSTANCE_SHOW(T,B); \
-INSTANCE_TYPEABLE0(T,C,S) ;
+INSTANCE_SHOW(T,B);
-#define INTEGRAL_TYPE_WITH_CTYPE(T,THE_CTYPE,C,S,B) \
+#define INTEGRAL_TYPE_WITH_CTYPE(T,THE_CTYPE,B) \
newtype {-# CTYPE "THE_CTYPE" #-} T = T B deriving (ARITHMETIC_CLASSES, INTEGRAL_CLASSES); \
INSTANCE_READ(T,B); \
-INSTANCE_SHOW(T,B); \
-INSTANCE_TYPEABLE0(T,C,S) ;
+INSTANCE_SHOW(T,B);
-#define FLOATING_TYPE(T,C,S,B) \
+#define FLOATING_TYPE(T,B) \
newtype T = T B deriving (ARITHMETIC_CLASSES, FLOATING_CLASSES); \
INSTANCE_READ(T,B); \
-INSTANCE_SHOW(T,B); \
-INSTANCE_TYPEABLE0(T,C,S) ;
+INSTANCE_SHOW(T,B);
#define INSTANCE_READ(T,B) \
instance Read T where { \
diff --git a/libraries/base/include/Typeable.h b/libraries/base/include/Typeable.h
index ae04142014..1a3149885d 100644
--- a/libraries/base/include/Typeable.h
+++ b/libraries/base/include/Typeable.h
@@ -14,6 +14,8 @@
#ifndef TYPEABLE_H
#define TYPEABLE_H
+#warning <Typeable.h> is obsolete and will be removed in GHC 7.10
+
-- // For GHC, we can use DeriveDataTypeable + StandaloneDeriving to
-- // generate the instances.