Several options for thread-local-storage (TLS) in Haskell.

Version on this page:0.1.1
LTS Haskell 22.29:0.2
Stackage Nightly 2024-07-13:0.2
Latest on Hackage:0.2

See all snapshots thread-local-storage appears in

BSD-3-Clause licensed by Ryan Newton
Maintained by [email protected]
This version can be pinned in stack with:thread-local-storage-0.1.1@sha256:656b1e2a8107dff0cfbffdbd6f926b1e14c2e445d90b11393da098eb98241c2c,2507

Module documentation for 0.1.1

Depends on 2 packages(full list with versions):


Hackage Hackage Dependencies Haskell Programming Language BSD3 License

See .cabal file for description.

Here are some example benchmark results (on an Ivy Bridge i7-3770), with a typical time of 10.4 nanoseconds to get to a TLS variable given one IO thread per OS thread:

example benchmarks


0.1.1 [2017.01.22]

  • Expose Data.TLS.PThread.Internal. Note that there are no API guarantees whatsoever with this module, so use it with caution.
  • Add pthread to extra-libraries. Without it, some systems suffer from linker errors when using this library.
  • Fix build on GHC 7.6 and 7.8.