named-binary-tag: NBT (named binary tag) serialization and deserialization.

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]


This project was created because the old nbt package has had a 1-liner open issue preventing compilation for 2 years now at the time of writing, despite submitting a pull request to fix it.

While I was at it, I went ahead and changed the data structure to use konsumlamm's rrb-vector package instead of lists or unboxed arrays for more well-rounded asymptotics.

StrictData is also turned on, and some functions are exported for reading/writing NBT files that remove some of the old boilerplate code.

[Skip to Readme]


Change log
Dependencies base (>=4.16.0 && <4.18), bytestring (>=0.11.3 && <0.12), cereal (>=0.5.8 && <0.6), containers (>=0.6.6 && <0.7), indexed-traversable (>=0.1.2 && <0.2), rrb-vector (>= && <0.2), text (>=2.0.1 && <2.1), zlib (>=0.6.3 && <0.7) [details]
License MIT
Author David Garland
Category Data
Home page
Bug tracker
Source repo head: git clone
Uploaded by davidgarland at 2022-10-11T14:43:59Z


[Index] [Quick Jump]


Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Readme for named-binary-tag-

[back to package description]


A replacement for the old nbt package, because that one has been defunct for 2 years due to missing a single-line fix.

There are also a few improvements(?) made while I was at it:


import Data.Nbt qualified as Nbt
import Data.Serialize

main :: IO ()
main = do
  shouldBeNbt <- Nbt.readCompressed "level.dat" :: IO (Either String Nbt') -- see also "Nbt.readUncompressed"
  case shouldBeNbt of
    Left err -> putStrLn err
    Right nbt -> do
      print nbt
      Nbt.writeCompressed "anotherlevel.dat" nbt -- see also "Nbt.writeUncompressed"

Possible Future Work