r/purescript • u/Kurren123 • Apr 21 '20
Is it worth learning Halogen?
I come from Elm and have some basic haskell experience (can work with typeclasses, monads, applicatives etc). Halogen just seems hugely over-complicated, is it worth taking all the trouble to learn this framework, particularly when there are Elm clones out there? What would you say is the return on investment?
Edit: I'm not asking about purescript as a language. I'm asking specifically about the Halogen framework vs other simpler purescript frameworks. Thanks
22
Upvotes
7
u/t-b Apr 21 '20
I’ve dabbled in Haskell over the years but never really progressed past beginner level. I highly, highly recommend Real World Halogen. The introduction is excellent, and even though the book is incomplete, the code base is incredibly readable and well commented. Most importantly, the architecture is thoughtful, beautiful and powerful. I’ve learned ideas that are transferable to other languages, and while the type errors in Halogen are bizarre at first, you can learn to debug them, you shouldn’t let that get in the way.
Good architecture is harder to learn than using a new framework, so even if you don’t ultimately use halogen, it will be time well spent. And who knows, maybe you’ll even find that Halogen is sufficient for all core logic and you’ll just integrate the occasional JS package via FFI.
4
u/fl00pz Apr 21 '20
Elm, React, Vue, and even ReasonML were much easier to get going for me than Halogen. I went through all the tutorials/repos/talks. By the time I got a few things working with Halogen, I could not see any good reason to keep going. I don't spend a ton of time in the front-end so the learning curve was just not worth it for me. However, I can't praise PureScript enough-- it's a very clean Haskell/ML. I don't mind that it compiles to JS/Node, or that the tools are in a mix of Node/Haskell. I'm glad that it has a clean frontend/backend compiler design because I think over time that PureScript's strength will be various backend targets (not it's JS/Node target).
2
u/__Adrielus__ Apr 21 '20
I tried learning halogen a few times and failed, but after I finally got it going I can say it was definitly worth it! Halogen feels like TEA but improved. I'm working with it on a side project and I'm loving it!
As another bonus, halogen hooks were released recently,which reduces the boilerplate for a lot of stuff, so you might want to check that out as well!
So I'd say keep going. I don't think you'll regret it:)
2
u/[deleted] Apr 22 '20
I have started to learn Halogen the previous weekend. You should read the learning documentation from Jordan Martinez
https://github.com/JordanMartinez/learn-halogen
It's very clear and easy to read.
2
u/jusrin Apr 22 '20
i've used purescript-react-basic at work for over two years now, and i integrate components like those from aws amplify as needed. at this point i have no interest in using halogen anymore, after having used purescript for over four years.
5
u/gilmi Apr 21 '20
I don't have an answer to your question because I ended up trying a different framework for a hobby project (a chat client) which was specular (pretty much an implementation of Haskell's reflex) and was satisfied with the result.
If you end up deciding against learning halogen, give it (or alternatively concur which should also be interesting) a try.
I used this very good guide to learn specular:
https://github.com/hansroland/reflex-dom-inbits/blob/master/tutorial.md
5
u/fokot2 Apr 22 '20
I have exactly the same question. I'm using Elm, and used a little Haskell on BE and lot of functional Scala. Once I tried to learn Halogen but I didn't get it. Or at least why it is better than TEA. And I heard people praising it, so I'm curious. And I think of using Purescript but why to choose Halogen and not Elm clone like https://flamepurs.org/ ? And in Elm I also like elm-ui lib. It would be benefical to write it for whatever framework I decide to use
3
u/clevertesuji Apr 28 '20
I haven’t done anything complicated, but after kicking the tires on all the current options, I massively prefer concur.
2
u/dj-amma Apr 27 '20
I think Halogen is the kind of framework where it looks really complicated at first but once you start building few components it's actually very simple. I second what has been said here by checking out the Real World Halogen repo. If it helps I made a cookiecutter generator built on the Real World Halogen repo which scaffolds a basic halogen structure. You can find the repo here.