HMap 0.902 → 0.912
raw patch · 3 files changed
+24/−11 lines, 3 filesdep +unordered-containersdep −containers
Dependencies added: unordered-containers
Dependencies removed: containers
Files
- ChangeLog +7/−0
- Data/HMap.hs +11/−7
- HMap.cabal +6/−4
+ ChangeLog view
@@ -0,0 +1,7 @@+0.912 : Replaced Data.Map with Hashmap for speed.++0.902 : Support for top level scoped keys++0.901: Improved cabal file++0.9 : Initial version
Data/HMap.hs view
@@ -1,10 +1,8 @@-{-# LANGUAGE RankNTypes, GADTs, CPP #-} +{-# LANGUAGE RankNTypes, GADTs, CPP, EmptyDataDecls #-} ----------------------------------------------------------------------------- -- | -- Module : Data.HMap -- Copyright : (c) Atze van der Ploeg 2013--- (c) Daan Leijen 2002--- (c) Andriy Palamarchuk 2008 -- License : BSD-style -- Maintainer : atzeus@gmail.org -- Stability : provisional@@ -67,7 +65,7 @@ -- > import Data.HMap (HMap) -- > import qualified Data.HMap as HMap ----- This module uses "Data.Map" as a backend. Every function from "Data.Map"+-- This module uses "Data.HashMap.Lazy" as a backend. Every function from "Data.Map" -- that makes sense in a heterogenous setting has been implemented. -- -- Note that the implementation is /left-biased/ -- the elements of a@@ -76,6 +74,7 @@ -- -- Operation comments contain the operation time complexity in -- the Big-O notation <http://en.wikipedia.org/wiki/Big_O_notation>.+-- ----------------------------------------------------------------------------- @@ -131,8 +130,10 @@ import Unsafe.Coerce import Data.Unique import System.IO.Unsafe-import Data.Map(Map)-import qualified Data.Map as M+import Data.Hashable+import Data.HashMap.Lazy(HashMap)++import qualified Data.HashMap.Lazy as M import Data.Maybe(fromJust) @@ -142,7 +143,10 @@ --------------------------------------------------------------------} -- | The HMap type. It's constructor is not exported for safety. -newtype HMap = HMap (Map Unique HideType) +instance Hashable Unique where+ hashWithSalt n u = n + hashUnique u++newtype HMap = HMap (HashMap Unique HideType) {-------------------------------------------------------------------- Keys
HMap.cabal view
@@ -1,7 +1,7 @@ Name: HMap-Version: 0.902+Version: 0.912 Synopsis: Fast heterogeneous maps.-Description: Fast heterogeneous maps based on Data.Map.+Description: Fast heterogeneous maps based on Hashmaps. License: BSD3 License-file: LICENSE Author: Atze van der Ploeg@@ -9,11 +9,13 @@ Homepage: https://github.com/atzeus/HMap Build-Type: Simple Cabal-Version: >=1.6+Data-files: ChangeLog Category: Data, Data Structures+Tested-With: GHC==7.6.3 Library- Build-Depends: base >= 2 && <= 6, containers >= 0.1.0.0+ Build-Depends: base >= 2 && <= 6, unordered-containers >= 0.2 Exposed-modules: Data.HMap- Extensions: RankNTypes, GADTs, CPP+ Extensions: RankNTypes, GADTs, CPP, EmptyDataDecls source-repository head type: git