This isn’t a question or anything. I just wanted to express how thankful I am for the Purescript community and its existence. I’ve been working on a website the past 2 weeks using Purescript with Halogen and it’s been the absolute best project I’ve worked on for years. Things just work. This is a very good contrast for me because the past years I’ve been sticking with dynamic languages because they are in higher demand by the “market”. Prior to this project I spent 3 months on a python web application using Python and Javascript. Things did not work. I spent load of time on testing, it did nothing. Everything I tested didn’t fail and everything I couldn’t imagine testing failed. Now I’ve spent 2 weeks on this Halogen project and it’s almost done. I haven’t even started testing and this app is more stable than anything I’ve worked on for the past 5 years. I’ve been doing features which requires some difficult functionality and there seems to be no shortage of libraries and most of them are kept well up to date. And if they don’t exist I just write the functionality and it usually takes less time than hooking up to a really famous nodejs library just to realise that it’s riddled with bugs and weird behaviour.
I’m thankful for the people in this community who have spent countless hours working on libraries and documenting the things they are doing. Seeing real world applications really helps and it’s probably the biggest reason I was able to go into this project using Purescript. I’m looking forward to the future of Purescript and I hope I can start contributing as well as soon as possible.
To all of you I just want to say thank you, keep on Purescripting and have a great weekend <3
Can I ask you how did you started?
I tried starting a project using purescript a year ago and it was very hard to me just to do the most basic things. There was a very great book, but the book was talking about version 0.11 and purescript just released 0.12, so nothing was working and it was very hard to figure out which libraries should I be using.
Glad to see your experience was way better.
I understand what you mean. I actually had a very similar experience when first starting out with Purescript because I hit the exact same transition you did. Version 0.12 was just out and everyone was slowly moving over but I couldn’t understand the differences or what they meant. But by following the changes in libraries that are actively updated I soon realised what was going on and how Eff was changed to Effect etc. At this point I started actively playing around with some 0.12 examples. It wasn’t always easy and at first I hit many blocks in trying to install this or that library but it was exactly because I was hitting a breaking change and I had no experience with the language.
So the first few months I wasn’t actually doing production code. Just going over small examples and trying to replicate them. My first Halogen component was written in summer of 2018. It was a component to send out messages to a mailing list. I would not write it this way today but I was just so happy to have a single component up and running.
But I think there are few things that helped me feeling comfortable with writing in Purescript. First of all I started writing in Haskell more actively about a year ago. I was maintaining a site for a festival and I decided to make Haskell serve all the data. I used Servant for API, Bloodhound for Elasticsearch bindings. Just doing this got me more familiar with pure functional code and it made it easier to read Purescript code as well since a lot of the same principles apply.
But what really helped me in this project I’m doing now is the halogen-realworld repository:
it really touches on everything that I had been trying to do with Purescript but I had no idea how to manage it on a bigger scale. Thomas Honeyman who made and maintains the repo also does a really good job of keeping it up to date. So as soon as Halogen 5 was out he started making updates to the real world repo with comments. I actually learned the changes from Halogen-4 to 5 through him and his excellent commentary.
another thing that really helped me is that I got to know the spago package manager and for me it really helped to be able to add to sets or overwrite, install from local path etc. I really feel comfortable with this package manager and I like using it and I feel I’m more productive with it than I was with bower.
There was a certain point were I just realised how mature the language is and how beneficial it is to use it in production. So I just tried extra hard and if I didn’t understand something I tried to find a library that was dealing with same things, comment, PR’s, messages on the slack channel, whatever. The thing is that Purescript is still a small community although it seems to be growing everyday so you’re not always going to find pre made solutions for your problem. But I’ve found the community is very helpful. Any question I ask and I usually get a very thorough and descriptive answer back. Purescript also has good tools like Pursuit (similar to Hoogle for Haskell) which has really helped me understand the underlying types for Halogen for example.
So now I feel more comfortable writing Purescript then just 4 months ago. I feel I understand the basics of the language so I can handle breaking changes better. But getting to that point took a bit of time, just like with Haskell. But it was forcing myself to do a real production project in Purescript that really helped the most.
Wow, that is a very great answer. Thank you very much for it.
I think it is just a matter of keep pushing. Probably the most frustrating part is that knowing other languages fluently it can be frustrating to not be able to do even the most basic things on Purescript. With basic things I mean, for example, reading a JSON response from a backend, something that I can do in a matter of seconds with JS.
Something I always try to build while learning new languages is a console utility, and it has been quite hard to do something useful wit PureScript verus how easy and fast is to do it on node.
I think I will keep trying, your messages were very encouraging.
Yep, it is a bit inconvenient that the official guide proposes you to use bower. I think it is not a good package manager and spago looks quite better. My only concern is that it looks hard to add new packages or deps to spargo bundles, at least not as easy as just adding something to the package.json
It’s a bit more writing sometimes since you have to lay out the dependencies for a package if it does not exist in the current set you are using. But overall I find it relatively simple. Check out this file at the very bottom:
https://raw.githubusercontent.com/naglalakk/cookiecutter-purescript-frontend/v5/{{cookiecutter.project_name}}/packages.dhall
It does both overrides and additions. Overrides are saying, I have the library but I want to override the version currently present in the package-set I’m using. Additions are everything that doesn’t exist in the package-set that I want to add. I can then run “spago verify” to verify that the overrides or addition don’t break the package-set I’m working with.