Dear all!
I would like to introduce my recent work: Halogen Helix, a lightweight global state management library for Halogen app.
At the time of writing, there already exists a great library sharing the same purpose: halogen-store, so what is the point of adding one?
Indeed Helix shares the fundamental concepts with halogen-store, but to be sure, it differs in several points:
-
Helix is hook-first
The Helix store can be accessed only in hook-style components. It is not impossible to connect non-hook style component to the Helix store, but to do that, you need to do some low level stuff.
-
Simple interface
With halogen-store’s useSelector
, it is also possible to access the store inside hook-style components, but the state value returned by the useSelector
hook is always wrapped in Maybe
context. With Helix providing functionality, the state value does not have additional Maybe
.
-
More granular structuring of State type
With halogen-store
, you define a single, sometimes large, store; with Helix, you can create as many stores as you need, leading more finely structured store definition.
For more information, please refer to the README. I hope you feel like to trying it out.
Any feedback would be appreciated!
12 Likes
I’m happy to announce the v1.0.0 release of halogen-helix 
Now you can install it with Spago, and read the API docs in the pursuit documentation site.
Since I have posted the reply-to, I have made some changes to the library:
- simplified internal state manipulation logic
-
added middleware API, the way to extend the store behavior with almost arbitrary effectful logic
- added some automated tests, unit and E2E
6 Likes
Hey,
Great library! I’m just starting out in Purescript but I found the api familiar enough coming from redux and react hooks.
I did notice one weird issue where my UseHelixHook state was sometimes undefined. I figured I could just check to make sure the value is defined but the type system does not recognize an undefined state.
I haven’t had a change to right an issue yet with an example repo, so I thought I’d mention here.
1 Like
Thank you for using Helix!
Hmm…It certainly seems that something is going wrong. I’m sorry for bothering you.
I will take a look and fix the bug as soon as possible, but as long as I read the description you wrote in the post, I have no clue what’s going on. So though I’ll do my best, it may take a moment to fix 
Hey! Super sorry for the crazy late reply! 
I’ve been really digging into this issue lately, and I think I finally fixed it!
So, if you’re still patiently using my library despite the bug, please update to v1.1.0!
And if you still run into the same issue, please let me know — though I really hope it won’t happen…
1 Like
Interesting to see this.
Thanks for your work!
I had recently been kind of admiring the CREM module in Haskell.
Honestly, I just wanted to put it on your radar in the hope that it would influence work toward this end in the Purescript ecosystem. Since Purescript type system is possibly even more capable than Haskell’s (in some ways namely with row types) it seems that this might be even more possible in Purescript. Singletons are a definite pre-requisite.
Obviously, your state module is halogen-based. So, I’d also like to put in my vote to build something a bit more framework-agnostic.
Thanks for sharing!