packages feed

HMap 0.91 → 0.901

raw patch · 3 files changed

+12/−46 lines, 3 filesdep +containersdep −unordered-containers

Dependencies added: containers

Dependencies removed: unordered-containers

Files

− ChangeLog
@@ -1,7 +0,0 @@-0.91 : 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,4 +1,4 @@-{-# LANGUAGE  RankNTypes, GADTs, CPP, EmptyDataDecls #-} +{-# LANGUAGE  RankNTypes, GADTs, CPP #-}  ----------------------------------------------------------------------------- -- | -- Module      :  Data.HMap@@ -41,34 +41,25 @@ -- > Edsger: salary=4450.0, female=False -- > Ada: salary=5000.0, female=True ----- This module differs from hackage package @hetero-map@ in the following ways:+-- The module differes from "HeteroMap.Map" in the following ways: -- -- * Lookup, insertion and updates are /O(log n)/ when using this module,---   whereas they are /O(n)/ when using @hetero-map@.+--   whereas they are /O(n)/ when using "HeteroMap.Map" --  -- * With this module we cannot statically ensure that a Heterogenous map  --   has a some key (i.e. (!) might throw error, like in "Data.Map").---   With @hetero-map@ it is possible to statically rule out +--   With "HeteroMap.Map" it is possible to statically rule out  --   such errors. -- -- * The interface of this module is more similar to "Data.Map" ----- This module differs from @stable-maps@ in the following ways:--- --- * Key can be created safely without using the IO monad.------ * The interface is more uniform and implements more of the---   "Data.Map" interface.------ -- Since many function names (but not the type name) clash with -- "Prelude" names, this module is usually imported @qualified@, e.g. -- -- >  import Data.HMap (HMap) -- >  import qualified Data.HMap as HMap ----- This module uses "Data.Map" as a backend. Every function from "Data.Map"--- that makes sense in a heterogenous setting has been implemented.+-- This module uses "Data.Map" as a backend. -- -- Note that the implementation is /left-biased/ -- the elements of a -- first argument are always preferred to the second, for example in@@ -76,7 +67,6 @@ -- -- Operation comments contain the operation time complexity in -- the Big-O notation <http://en.wikipedia.org/wiki/Big_O_notation>.--- -----------------------------------------------------------------------------  @@ -88,8 +78,7 @@             -- * Keys             , Key             , withKey-            , T-            , createKey+             -- * Operators             , (!), (\\) @@ -132,10 +121,8 @@ import Unsafe.Coerce import Data.Unique import System.IO.Unsafe-import Data.Hashable-import Data.HashMap.Lazy(HashMap)--import qualified Data.HashMap.Lazy as M+import Data.Map(Map)+import qualified Data.Map as M import Data.Maybe(fromJust)  @@ -145,10 +132,7 @@ --------------------------------------------------------------------} -- | The HMap type. It's constructor is not exported for safety. -instance Hashable Unique where-  hashWithSalt n u = n + hashUnique u--newtype HMap = HMap (HashMap Unique HideType) +newtype HMap = HMap (Map Unique HideType)   {--------------------------------------------------------------------   Keys@@ -158,8 +142,6 @@ data HideType where   HideType :: a -> HideType -- unsafeFromHideType :: HideType -> a unsafeFromHideType (HideType x) = unsafeCoerce x @@ -172,13 +154,6 @@  withKey :: (forall x. Key x a -> b) -> b withKey f = f $ Key $ unsafePerformIO newUnique---- | The scope of top-level keys.-data T ---- | /O(1)/. Create a new top-level key.-createKey :: IO (Key T a)-createKey = fmap Key newUnique  {--------------------------------------------------------------------   Operators
HMap.cabal view
@@ -1,7 +1,7 @@ Name:                HMap-Version:             0.91+Version:             0.901 Synopsis:	     Fast heterogeneous maps.-Description:         Fast heterogeneous maps based on Hashmaps.+Description:         Fast heterogeneous maps based on Data.Map. License:             BSD3 License-file:        LICENSE Author:              Atze van der Ploeg@@ -9,11 +9,9 @@ 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, unordered-containers >= 0.2+  Build-Depends: base >= 2 && <= 6, containers >= 0.1.0.0   Exposed-modules: Data.HMap   Extensions:	RankNTypes, GADTs, CPP