Efficient hash-consing for arbitrary data types

Version on this page:0.9.3
LTS Haskell 17.0:0.9.3@rev:1
Stackage Nightly 2021-01-27:0.9.3@rev:1
Latest on Hackage:0.9.3@rev:1

See all snapshots intern appears in

BSD-3-Clause licensed by Edward A. Kmett
Maintained by Edward A. Kmett
This version can be pinned in stack with:intern-0.9.3@sha256:e7ffb6eb4df149774cf8dd87d2bf639d6e1871eee04915da2d596da16eb459be,1670
Used by 2 packages in nightly-2020-12-03(full list with versions):


Hackage Build Status

Efficient hash-consing for arbitrary data types.

Contact Information

Contributions and bug reports are welcome!

Please feel free to contact me through github or on the #haskell IRC channel on

-Edward Kmett


0.9.3 [2020.09.30]

  • Add Hashable instances for InternedString, InternedByteString, InternedText, and IntSet.


  • Add a Semigroup IntSet instance.


  • Removed identity from the Interned class, to support applications where the identity is obtained by other means (e.g. a unique Ptr value)


  • Disabled cache removal as it was causing problems on large data sets. There is no good way to ensure that both references remain alive long enough to finish comparisons.
  • Switched to IORef from MVar


  • Fixed problem where comparisons could happen between data structures while one was still a thunk, leading to equal structures comparing as inequal in limited circumstances, by appropriately using strictness annotations.


  • Widened the caches so they don’t go through a single MVar per type. This has made a dramatic impact on performance. However, this broke the previous invariant that newer entries always had higher Ids than older entries.


  • Added Data.Interned.IntSet