From 472440c233fccf662ff41193db66c62e7bc6f6d1 Mon Sep 17 00:00:00 2001 From: Ɓukasz Hanuszczak Date: Fri, 31 Jul 2015 20:16:33 +0200 Subject: Make identifier generation also architecture-independent. --- haddock-api/src/Haddock/Backends/Xhtml/Decl.hs | 12 ++++--- html-test/ref/Bug7.html | 8 ++--- html-test/ref/Hash.html | 8 ++--- html-test/ref/HiddenInstances.html | 16 +++++----- html-test/ref/HiddenInstancesB.html | 8 ++--- html-test/ref/QuasiExpr.html | 4 +-- html-test/ref/SpuriousSuperclassConstraints.html | 8 ++--- html-test/ref/Test.html | 4 +-- html-test/ref/TypeFamilies.html | 40 ++++++++++++------------ 9 files changed, 55 insertions(+), 53 deletions(-) diff --git a/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs b/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs index c30d0e62..f1203210 100644 --- a/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs +++ b/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs @@ -31,10 +31,12 @@ import Haddock.Syb import Haddock.Doc (combineDocumentation) import Data.Bits +import Data.Char import Data.Data (Data, cast) import Data.List ( intersperse, sort ) import qualified Data.Map as Map import Data.Maybe +import Data.Word import Text.XHtml hiding ( name, title, p, quote ) import GHC @@ -636,16 +638,16 @@ instanceId orgin no ihd = concat -- section anchors in testing framework and that is not only inconvenient but -- also makes testing less viable. And it is only temporary solution so we can -- live with it. -instHeadId :: InstHead DocName -> Int +instHeadId :: InstHead DocName -> Word64 instHeadId (InstHead { .. }) = - djb2 . map key $ [ihdClsName] ++ names ihdTypes ++ names ihdKinds + djb2 id . map key $ [ihdClsName] ++ names ihdTypes ++ names ihdKinds where names = everything (++) $ maybeToList . (cast :: forall a. Data a => a -> Maybe DocName) - key = djb2 . occNameString . nameOccName . getName + key = djb2 (fromIntegral . ord) . occNameString . nameOccName . getName - djb2 :: Enum a => [a] -> Int - djb2 = foldl (\h c -> h * 33 `xor` fromEnum c) 5381 + djb2 :: (a -> Word64) -> [a] -> Word64 + djb2 conv = foldl (\h c -> h * 33 `xor` conv c) 5381 ------------------------------------------------------------------------------- diff --git a/html-test/ref/Bug7.html b/html-test/ref/Bug7.html index f0fbc44d..4c0ba83b 100644 --- a/html-test/ref/Bug7.html +++ b/html-test/ref/Bug7.html @@ -106,7 +106,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug7.html");}; >