5 ms·
- I’ve used everything. NodeJS, React, Rails, Python , Rust. Once I learned Haskell I fell in love and never went back. I code in Haskell because I enjoy it, I
by tofukid 5y ago
- I’ve used everything. NodeJS, React, Rails, Python , Rust. Once I learned Haskell I fell in love and never went back. I code in Haskell because I enjoy it, I can sleep at night because of the safety guarantees (no crashes), and I find it aesthetically pleasing and easy to think in. One of the things I enjoy most is the stability of the package APIs.
- I try to avoid JS. I do progressive enhancement with vanilla JS, and avoid JS webapps unless absolutely necessary. If I need to write a JS webapp, I use a purely functional approach. I found that when writing React, using frameworks, using TypeScript or PureScript, I lost so much time and effort managing my build step and fighting with APIs and package churn. I use preact with the htm library, vanilla JS, and most importantly no build step and no npm. I don’t use a framework. I use a purely functional approach inspired from Haskell/Elm. I have an update function which returns a new state and effects from the current state and event, and a dispatch function which is attached to onevent props. The dispatch function calls the update function, renders, and runs effects. These few functions are 20 lines of code.
- No challenges specific to Haskell so far. Of course I had to learn the ecosystem when I started, which packages to use, language and tooling gotchas, etc. but that is the case for any language.
- Zababa 5y agoThanks for the detailed answer. The way you handle JS is very interesting.
- tofukid 5y agoThe most important thing for me is rapid development with no surprises and package churn, since I'm either trying to get an MVP out ASAP, or I'm trying to deliver under a deadline for a client. Here's an example of a working app using my approach I described above: https://jsbin.com/putonutica/edit?js,output https://jsbin.com/putonutica/edit?js,output The two functions, render and dispatch, are essentially the only code I share across the projects. That's the whole "framework". It's 19 lines of code. All it requires is a link to Preact, which is 14K. Oh, and I just keep everything in one big file. Simple, but I've built multiple complex single-page JS apps with this approach. I'm sure someone will tell me I'm doing it all wrong, and I need to use Next.js with webpack, a giant stack of npm packages, code-splitting and bundling, and whatever craziness front-end developers are doing today.
- Zababa 5y agoThanks for the example. You're right about package churn, especially if you're working alone. You don't want to spend all your time updating dependencies. Not having a build step must be a breath of fresh air too.
- tofukid 5y agoOn second thought, there is one minor annoyance with Haskell: Most companies don’t release an API client for it, so I often have to make the HTTP calls myself to various third party services.