[Haskell-cafe] Functions from Data.Hashtable

Henning Thielemann lemming at henning-thielemann.de
Tue Apr 7 18:38:27 EDT 2009

On Wed, 8 Apr 2009, Peter Verswyvelen wrote:

> These functions have their arguments reversed when compare to e.g. Map
> For example
> Data.HashTable.lookup :: HashTable key val -> key -> IO (Maybe val)
> Data.Map.lookup :: Ord key => key -> Map key val -> Maybe val

For my taste, Data.Map.lookup has the wrong parameter order, since I often 
need the same Map with different keys and not vice versa. The 
HashTable.lookup parameter order can also be read as mapping a Map to the 
function it represents. I mean (HashTable key val) and (Map key val) 
represent functions of type (key -> val) and you can write:
   Data.HashTable.lookup :: HashTable key val -> (key -> IO (Maybe val))


More information about the Haskell-Cafe mailing list