Skip to content

Update carpenter to latest Gleam features#5

Open
ghivert wants to merge 10 commits into
grottohub:mainfrom
ghivert:main
Open

Update carpenter to latest Gleam features#5
ghivert wants to merge 10 commits into
grottohub:mainfrom
ghivert:main

Conversation

@ghivert
Copy link
Copy Markdown

@ghivert ghivert commented Jun 25, 2025

Hi!

Gleam evolved quickly during the latest year, and as such, things have changed.
That Pull Request come to maintain carpenter in a usable, compatible state with the rest of the ecosystem.

That PR:

  • upgrades gleam_erlang to version 1.0.0. This should be future-proof, as API becomes more stable.
  • fixes FFI and implements exhaustive tests: every function is tested against its signature, and no information can leak from FFI anymore.
  • implements latest usage of assert in tests, providing better information, more context, and simpler tests.
  • renames carpenter.erl to carpenter_ffi.erl, to match Gleam conventions to write FFI files as *_ffi modules. Indeed, in the future, adding a carpenter.gleam file would mess up with the FFI file, so renaming it make sure nothing will ever break in the future.
  • updates README with latest Gleam status (i.e. echo mainly).
  • make sure tests run at every push on GitHub Actions, to help development if somebody forget to run tests locally once.
  • improves a bit the code, by adding an internal props.gleam module, to help working with atoms lists.

Tell me if anything is not to your taste, I took freedom to directly implement changes as I would do, because I needed them for production. I tried to not modify too much things though.

@ghivert
Copy link
Copy Markdown
Author

ghivert commented Sep 23, 2025

Hi @grottohub, no pressure, but I'm curious if you can find some time to review that PR. We're currently relying on carpenter in production, and I'd find it cool to have it properly updated in Hex, rather than depending on my own fork of carpenter. 😇
I could help for maintenance if needed, if you lack time or energy to maintain carpenter (we can find some time at Steerlab to run updates on carpenter).

@chuckberrypi
Copy link
Copy Markdown

chuckberrypi commented Jan 2, 2026

Hi @ghivert, since it doesn't seem like this repo is active, and, as you mentioned, no longer works with current versions of gleam, would you consider possibly publishing your fork to hex, especially seeing as you're willing to maintain it? This would be really useful, and I don't see any other active libraries that fill this niche in the gleam ecosystem. (Bravo also appears to be relying on pre-1.0.0 gleam versions). [EDIT--nevermind. I just saw that the Bravo maintainer has posted in the last couple hours that he intends to update that library, so maybe it will be available soon for my project]

@ghivert
Copy link
Copy Markdown
Author

ghivert commented Jan 22, 2026

Hi @chuckberrypi, as I thought, ghivert/carpenter is up to date, and works with the current versions of Gleam. No deprecations or anything, tests are passing.

You can expect that package to be maintained in the future, notably because we're using it heavily at Steerlab. However, I won't release the package on the Hex repository. If you want more context, take a look at the Gleam Discord discussion about carpenter. (It's in the Gleam Discord, so you need an account to see the conversation.)

However, you can simply import the package as a git dependency if you need it. Here's the blog post talking about it..

I'm not sure why you need that package, but keep in mind you have access to other ETS packages, like cell, or you can write your bindings to ETS rather simply. I think carpenter is a witness of older Gleam times, where you could still coerce data in a simple way. Unless you really know what you are doing, you should probably avoid things like that. But as I said, you have more experience than I have on your own projects, and if you think that carpenter is the best option out there for you, feel free to use my version, it's working, it's up to date, and it's running in production since 8 months.

@janwirth
Copy link
Copy Markdown

I also opened a PR here, but it seems @grottohub is not up for maintenance anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants