HpcMap.hs 721 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11
module HpcMap ( module HpcMap ) where

#if __GLASGOW_HASKELL__ < 604
import qualified Data.FiniteMap as Map
#else
import qualified Data.Map as Map
#endif


lookup :: Ord key => key -> Map key elt -> Maybe elt
fromList :: Ord key => [(key,elt)] -> Map key elt
andy@galois.com's avatar
andy@galois.com committed
12
fromListWith :: Ord k => (a -> a -> a) -> [(k, a)] -> Map k a
Ian Lynagh's avatar
Ian Lynagh committed
13
toList :: Ord key => Map key elt -> [(key,elt)]
14 15 16 17 18 19

#if __GLASGOW_HASKELL__ < 604
type Map key elt = Map.FiniteMap key elt

lookup = flip Map.lookupFM
fromList = Map.listToFM 
20 21
fromListWith f xs = Map.addListToFM_C f Map.emptyFM xs
toList = Map.fmToList
22 23 24 25 26 27 28

#else

type Map key elt = Map.Map key elt

lookup = Map.lookup
fromList = Map.fromList
andy@galois.com's avatar
andy@galois.com committed
29 30
toList   = Map.toList
fromListWith = Map.fromListWith
31 32

#endif