symbolize-1.0.0.1: symbolize.cabal
cabal-version: 2.2
-- This file has been generated from package.yaml by hpack version 0.35.2.
--
-- see: https://github.com/sol/hpack
name: symbolize
version: 1.0.0.1
synopsis: Efficient global Symbol table, with Garbage Collection.
description: Symbols, also known as Atoms or Interned Strings, are a common technique
to reduce memory usage and improve performance when using many small strings:
.
A Symbol represents a string (any `Textual`, so String, Text, ShortText, ByteString, ShortByteString, etc.)
.
Just like `ShortText`, `ShortByteString` and `ByteArray`, a `Symbol` has an optimized memory representation,
directly wrapping a primitive `ByteArray#`.
.
Furthermore, a global symbol table keeps track of which values currently exist, ensuring we always deduplicate symbols.
This therefore allows us to:
- Check for equality between symbols in constant-time (using pointer equality)
- Calculate the hash in constant-time (using `StableName`)
- Keep the memory footprint of repeatedly-seen strings low.
.
This is very useful if you're frequently comparing strings
and the same strings might come up many times.
It also makes Symbol a great candidate for a key in e.g. a `HashMap` or `HashSet`.
.
The global symbol table is implemented using weak pointers,
which means that unused symbols will be garbage collected.
As such, you do not need to be concerned about memory leaks
(as is the case with many other symbol table implementations).
.
The main advantages of Symbolize over other symbol table implementations are:
.
- Garbage collection: Symbols which are no longer used are automatically cleaned up.
- Support for any `Textual` type, including `String`, (strict and lazy) `Data.Text`, (strict and lazy) `Data.ByteString`, `ShortText`, `ShortByteString`, etc.
- Great memory usage:
- `Symbol`s are simply a (lifted) wrapper around a `ByteArray#`, which is nicely unpacked by GHC.
- The symbol table is an `IntMap` that contains weak pointers to these same `ByteArray#`s and their associated `StableName#`s
- Great performance:
- `unintern` is a simple pointer-dereference
- calls to `lookup` are free of atomic memory barriers (and never have to wait on a concurrent thread running `intern`)
- Thread-safe
.
Please see the full README below or on GitHub at <https://github.com/Qqwy/haskell-symbolize#readme>
category: Data, Data Structures
homepage: https://github.com/Qqwy/haskell-symbolize#readme
bug-reports: https://github.com/Qqwy/haskell-symbolize/issues
author: Qqwy / Marten
maintainer: qqwy@gmx.com
copyright: 2023-2025 Marten Wijnja
license: BSD-3-Clause
license-file: LICENSE
build-type: Simple
tested-with:
GHC ==9.4.8 || ==9.6.6 || ==9.8.4 || ==9.10.1
extra-source-files:
README.md
CHANGELOG.md
source-repository head
type: git
location: https://github.com/Qqwy/haskell-symbolize
library
exposed-modules:
Symbolize
Symbolize.Textual
other-modules:
Symbolize.Accursed
Symbolize.SipHash
Symbolize.SymbolTable
hs-source-dirs:
src
default-extensions:
BangPatterns
OverloadedStrings
DeriveAnyClass
TypeApplications
NamedFieldPuns
ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints
build-depends:
base >=4.7 && <5
, bytestring >=0.11.0 && <0.13
, containers >=0.6.0 && <0.7
, deepseq >=1.4.0 && <1.6
, hashable >=1.4.0 && <1.5
, random >=1.2 && <2
, text >=2.0 && <2.2
, text-short >=0.1.0 && <0.2
default-language: Haskell2010
test-suite symbolize-doctest
type: exitcode-stdio-1.0
main-is: DocTest.hs
other-modules:
Paths_symbolize
autogen-modules:
Paths_symbolize
hs-source-dirs:
test/doctest
default-extensions:
BangPatterns
OverloadedStrings
DeriveAnyClass
TypeApplications
NamedFieldPuns
ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N
build-depends:
base >=4.7 && <5
, bytestring >=0.11.0 && <0.13
, containers >=0.6.0 && <0.7
, deepseq >=1.4.0 && <1.6
, doctest-parallel
, hashable >=1.4.0 && <1.5
, random >=1.2 && <2
, symbolize
, text >=2.0 && <2.2
, text-short >=0.1.0 && <0.2
default-language: Haskell2010
test-suite symbolize-test
type: exitcode-stdio-1.0
main-is: Suite.hs
other-modules:
SymbolizeTest
Paths_symbolize
autogen-modules:
Paths_symbolize
hs-source-dirs:
test/suite
default-extensions:
BangPatterns
OverloadedStrings
DeriveAnyClass
TypeApplications
NamedFieldPuns
ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N
build-tool-depends:
tasty-discover:tasty-discover
build-depends:
async
, base >=4.7 && <5
, bytestring >=0.11.0 && <0.13
, containers >=0.6.0 && <0.7
, deepseq >=1.4.0 && <1.6
, hashable >=1.4.0 && <1.5
, hedgehog
, random >=1.2 && <2
, symbolize
, tasty
, tasty-golden
, tasty-hedgehog
, tasty-hunit
, text >=2.0 && <2.2
, text-short >=0.1.0 && <0.2
default-language: Haskell2010