Skip to content

athanclark/purescript-intmap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

purescript-intmap

Why?

Although we have ordered-collections, a Map Int a introduces many levels of indirection; it's internally based on a binary/ternary tree for performing lookups, and although very efficient for arbitrary key types that support total ordering, is not efficient for a simple type like Int, which could capitalize on bitwise efficiency.

However, we also have Foreign.Object, which is just a javascript map, but acts like a Map String a - acting as fast as javascript permits when performing lookups a' la foo["bar"].

This package is not intended to be performant with respect to Haskell's infamous IntMap in https://hackage.haskell.org/package/containers; there is no amortized cost analysis or Patricia trees here; just a simple wrapper around Foreign.Object.

However, it is convenient for those of us who want to use numbers as keys, but don't want to do all the parsing and printing manually.

About

A basic IntMap that leverages Foreign.Object

Resources

License

Stars

Watchers

Forks

Packages

No packages published