
7 Apr
2009
7 Apr
'09
6:38 p.m.
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)) http://www.haskell.org/haskellwiki/Parameter_order