5 ms·
It's really good for boring, line of business software (BLOBS). The vast majority of business logic can be modelled with a handful of simple types and pattern
by agentultra 2y ago
It's really good for boring, line of business software (BLOBS).
The vast majority of business logic can be modelled with a handful of simple types and pattern matching. Very few design patterns are needed. And if you keep to the simple parts you can even teach the syntax (just the types) to non-technical contributors in an afternoon. Then they can read it and help verify that you implemented the business process correctly.
It's also just nice for how my brain works. I like being able to substitute terms and get an equivalent program. Or that I can remember a handful of transformation rules that often get me from a first cut of a program to an efficient, fast one.
And it's just fun.
- darby_nine 2y agoIf that's what you're looking for, why not rip out most of the language? You'll end up with something that looks a lot like Elm. You'll end up with a purely deterministic program with no i/o (albeit with a kind of crappy debugging experience).
- agentultra 2y agoWell because you need the rest of the language to make your program tell your system to do stuff. Turns out `IO` is the most essential and useful bit of a Haskell program. That part can be left to the programmers. Haskell has a lot of facilities for making that nicer to work with as well. I find that when I tell folks I work in Haskell full-time you can see their opinion of you change on their face. I'm not some kind of PhD genius programmer. I'm pretty middle-of-the-road to be honest. It's just nice to have a language that makes the work of writing BLOBS straight-forward.
- darby_nine 2y ago> Well because you need the rest of the language to make your program tell your system to do stuff. That's not necessary for business logic, though. This would presumably be embedded in infrastructure that handled i/o separately.
- agentultra 2y agoI've heard of systems like Roc + Nea taking this to the extreme [0]. Totally a way to go. Haskell, to some extent, can help you structure your program in this way where the business logic is just simple, plain, old functional code. You can write the data marshalling, logging, and networking layers separately. There are a few ways to tackle that in Haskell in varying levels of complexity as you would expect coming from other general-purpose programming languages. [0] https://www.youtube.com/watch?v=zMRfCZo8eAc&t=952s https://www.youtube.com/watch?v=zMRfCZo8eAc&t=952s
- mumblemumble 2y agoIt is. But I think that, for that purpose, I like F# even better. Even beyond getting access to the .NET ecosystem, you also get some language design decisions that were specifically meant to make it easier to maintain large codebases that are shared among developers with varying skill levels. Lack of typeclasses is a good example. Interface inheritance isn't my favorite, but after years working as the technical lead on a Scala project I've been forced to concede that haranguing people who just want to do their job and go home to their family about how to use them properly isn't a good use of anyone's time. Everyone comes out of school already knowing how to use interfaces and parametric polymorphism, and that is fine.
- agentultra 2y agoI adore Scott Wlaschin's work [0] -- that's where I picked up on the acronym, BLOBS! F# is super cool, I agree. [0] https://www.youtube.com/watch?v=Up7LcbGZFuo https://www.youtube.com/watch?v=Up7LcbGZFuo
- chefandy 2y agoAnecdotally, the handful of people I've known that worked in commercial Haskell shops, after the initial honeymoon period intensified by actually finding a paying Haskell dev job, wishes they were using a more practical "happy medium" FP language. I don't know anyone that's used F# in production, but nobody I know that's worked in Elixir, erlang, or elm environments has expressed the same frustration.
- gavinray 2y agoOnly on HN will you read someone unironically suggest writing LOB software in Haskell.
- tome 2y agoWhy not? Many of us do it every day.
- gavinray 2y agoLet's suppose that you and I are non-technical founders of some medium-size software product. If we were to rank the most important factors in choosing how to build our product, I think we may be able to agree that they're likely: - The talent pool and availability of the language - The ecosystem of libraries and ancillary tools like monitoring/debugging/observability - The speed-of-development vs cost-of-maintenance tradeoff of the language I will give Haskell that it can be rapidly written by those proficient, and tends to have less bugs if it compiles than many languages. But for "what language is easy to employ and has an expansive ecosystem + tooling", I feel like you have to hand it to Java, .NET, Python, TypeScript, Go, etc...
- tome 2y agoThat's shifting the goalposts somewhat! Can Haskell be used for LOB software. Yes! In fact it's the one I am most effective in for that purpose. If I was starting a startup, it would be in Haskell, no question. "Let's suppose that you and I are non-technical founders of some medium-size software product ..." Well, that's something else entirely.
- mchaver 2y agoI am unironically being paid to do it! My experience is Haskell is one of those ecosystems that has a greater talent pool than there are available positions. I feel like cost of maintenance is pretty nice because you have less bugs. You may have to roll up your sleeves and get your hands dirty to update open source libraries or make stuff that is missing, but code reliability seems to be worth it.
- deleted 2y ago
- ninetyninenine 2y agoHaskell is just hard when you get to the advanced stuff. I mean beyond monads there’s the state monad, lenses, etc. a lot of these are not trivial to wrap your brain around. Like for Java head first design patterns I read it and I’m good. For monads it took me weeks to wrap my head around it and I still don’t understand every monad. Yeah I get a bunch of basic apps can be modeled easily, you get unparalleled static safety but programmers will spend an inordinate amount of time figuring out mind bending algebraic patterns. I think something like ocaml or f sharp are more down to earth.
- agentultra 2y agoThe advanced parts of most languages can get hairy. Don't mistake familiarity with complexity. Even Java has hard, dense code that is difficult to work with and learn. I tend to stay away from the advanced parts of Haskell when writing BLOBS. The advanced stuff is there when you need to write libraries that need generic code that works with types you haven't defined yourself. You learn it as you go when you need to. But when I'm writing BLOBS I mostly stick to using libraries and that's pretty straight-forward.
- deleted 2y ago[deleted]
- bazoom42 2y agoSounds about as plausible as “Non-programmers can draw the business logic as UML diagrams, then the code can be generated by automated tools”