about summary refs log tree commit diff
path: root/users/sterni/nix/utf8/tests/default.nix (follow)
AgeCommit message (Collapse)AuthorFilesLines
2021-04-10 r/2460 refactor(sterni): use pkgs over third_party to import from nixpkgssterni1-2/+2
This should ease migrating to a distinction between depot.third_party and pkgs (as in nixpkgs) in the future. Ref cl/2910, b/108. Change-Id: I53a854071fddd7c0d0526cc4c5b16998202082c6 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2913 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
2021-03-05 r/2270 feat(users/sterni/nix/utf8): pure nix utf-8 decodersterni1-0/+121
users.sterni.nix.utf8 implements UTF-8 decoding in pure nix. We implement the decoding as a simple state machine which is fed one byte at a time. Decoding whole strings is possible by subsequently calling step. This is done in decode which uses builtins.foldl' to get around recursion restrictions and a neat trick using builtins.deepSeq puck showed me limiting the size of the thunks in a foldl' (which can also cause a stack overflow). This makes decoding arbitrarily large UTF-8 files into codepoints using nix theoretically possible, but it is not really practical: Decoding a 36KB LaTeX file I had lying around takes ~160s on my laptop. Change-Id: Iab8c973dac89074ec280b4880a7408e0b3d19bc7 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2590 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>