summaryrefslogtreecommitdiff
path: root/libraries/base/configure.ac
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2011-07-08 10:39:24 +0100
committerSimon Marlow <marlowsd@gmail.com>2011-07-11 10:26:27 +0100
commite0b63e02b78d0bd31a073738b1154a93d22dccca (patch)
tree5f2a3a4553e6c6f308027b86049703acd4275400 /libraries/base/configure.ac
parente11e9ff5045dd2e0ee9d109057c15459d1e5011f (diff)
downloadhaskell-e0b63e02b78d0bd31a073738b1154a93d22dccca.tar.gz
Typeable overhaul (see #5275)
Instances of Typeable used to call mkTyCon: mkTyCon :: String -> TyCon which internally kept a table mapping Strings to Ints, so that each TyCon could be given a unique Int for fast comparison. This meant the String has to be unique across all types in the program. However, derived instances of typeable used the qualified original name (e.g. "GHC.Types.Int") which is not necessarily unique, is non-portable, and exposes implementation details. The String passed to mkTyCon is returned by tyConString :: TyCon -> String which let the user get at this non-portable representation (also the Show instance returns this String). Now we store three Strings in TyCon. The internal representation is this: data TyCon = TyCon { tyConHash :: {-# UNPACK #-} !Fingerprint, tyConPackage :: String, tyConModule :: String, tyConName :: String } (internal representations are now provided by Data.Typeable.Internal) The fields of TyCon are not exposed via the public API. Together the three fields tyConPackage, tyConModule and tyConName uniquely identify a TyCon, and the Fingerprint is a hash of the concatenation of these three Strings (so no more internal cache to map strings to unique Ids). tyConString now returns the value of tyConName only, so is therefore portable (but the String returned does not uniquely identify the TyCon). I've measured the performance impact of this change, and performance seems to be uniformly better. This should improve things for SYB in particular. Also, the size of the code generated for deriving Typeable is less than half as much as before. == API changes == === mkTyCon is DEPRECATED == mkTyCon is used by some hand-written instances of Typeable. It still works as before, but is deprecated in favour of... === Add mkTyCon3 === mkTyCon3 :: String -> String -> String -> TyCon mkTyCon3 takes the package, module, and name of the TyCon respectively. Most users can just derive Typeable, there's no need to use mkTyCon3. In due course we can rename mkTyCon3 back to mkTyCon. === typeRepKey changed === Previously we had typeRepKey :: TypeRep -> IO Int but since we don't assign unique Ints to TypeReps any more, this is difficult to implement. Instead we provide an abstract key type which is an instance of Eq and Ord, and internally is implemented by the fingerprint: data TypeRepKey -- abstract, instance of Eq, Ord typeRepKey :: TypeRep -> IO TypeRepKey typeRepKey is still in the IO monad, because the Ord instance is implementation-defined.
Diffstat (limited to 'libraries/base/configure.ac')
-rw-r--r--libraries/base/configure.ac3
1 files changed, 3 insertions, 0 deletions
diff --git a/libraries/base/configure.ac b/libraries/base/configure.ac
index acfd48e5ca..1db0c268e6 100644
--- a/libraries/base/configure.ac
+++ b/libraries/base/configure.ac
@@ -167,6 +167,9 @@ FP_SEARCH_LIBS_PROTO(
[AC_DEFINE([HAVE_LIBCHARSET], [1], [Define to 1 if you have libcharset.])
EXTRA_LIBS="$EXTRA_LIBS $ac_lib"])
+# Hack - md5.h needs HsFFI.h. Is there a better way to do this?
+CFLAGS="-I../../includes $CFLAGS"
+AC_CHECK_SIZEOF([struct MD5Context], ,[#include "include/md5.h"])
AC_SUBST(EXTRA_LIBS)
AC_CONFIG_FILES([base.buildinfo])