I cannot imagine anyone using a database effectively on any significant amount of data without understanding indexes, how different joins work, why join order is important, what effect join orders have on performance, etc. Get to a certain scale and it's not enough to know about indexes; you need to understand the structure of b-trees, disk I/O performance, how CPU cache performance affects b-tree navigation even when index is cached in memory, how to use compound indexes effectively to reduce random access through the index, etc.
The constraints of CPU and memory never go away, and if you're trying to scale something, you're going to be limited on either or both of those resources. That in turn forces you to understand execution and memory behaviour of the abstractions you're working with. All abstractions leak when pushed.
You'd be surprised just what proportion of systems running in the market operate on amounts of data you would not deem "significant".
And as I said in another comment, Haskell doesn't try to pretend that computations run with no hardware constraints.
> All abstractions leak when pushed
Yeah. But we might have wildly different ideas for where that boundary is.
But conversely you probably didn't have to understand what filesystem the database runs on, whether it is in a RAID array, whether the network connection was over Ethernet or T1, etc.
All abstractions leak. The question is how leaky they are. In my experience Haskell abstractions are much less leaky than most.
Why? You seem unsatisfied with any of the previous layers of abstraction, so where does it end? When can I truly call myself a user of a database?
When you treat it as a black-to-grey box, not a grey-to-white box.
Laziness is a definitely a double-edged sword, with sharp edges.
It's definitely a wart of laziness, but it's also pretty easy to avoid.
As far as abtraction goes, laziness doesn't leak. In fact, it's a big reason Haskell performance composes. The head . sort example is contrived, but it holds true in more complicated & useful examples as well!
I have to understand all the intricacies of the system, so people who choose to treat databases as black boxes don't have to. There is only so far this abstraction holds.
Stateless (immutable) code scales horizontally. ACID[1] doesn't.
Turns out NTFS has a maximum number of file fragments a file can have, and if it exceeds that it will refuse to grow the file (for obvious reasons).
Hardly everyday stuff though.
There is also other aspect of this, even if I do not understand joins or b-trees I can measure performance so I can figure out which combintion of joins are the faster. The reason that I prefer performance testing over getting to know the theorethical background for certain things is because in many cases your performance also depend on the implementation details, not only on which tree data structure backs your implementation.
Implementation details follow the contours of the fundamental algorithms and data structures. You understand the outline of the implementation details - the bones, if you will - from that. And you can dive into the source (or disassembler - I've done that on Windows) to fine tune knowledge of other specifics, with e.g. gdb stack traces on the database engine when it is abnormally slow to focus attention.
Without having gone to battle together over some performance problems, or me writing significantly longer battle-story posts, we're probably not going to be able to communicate effectively here.
This is abstraction. If there's one thing Haskell does well it's abstraction.
EDIT: It's really bizarre. We see these same responses to all the Haskell-or-Idris-or-whatever threads -- I wonder if there's some imposter syndrome going where "I can't immediately read/write Haskell" somehow morphs into "Haskell is useless". IME it's really rare for people who actually program in Haskell to have serious issues with the language. Yes there are issues from a smaller ecosystem, package management was bad (Stack fixed that), etc. etc. but there are very few fundamental problems with the language. Something so small as just Pattern Matching is a huge increase in productivity. Thankfully, quite a few languages have adopted pattern matching these days (Scala, Rust, TS, maybe even C++23?).
(The really big payoff comes from granular effects, but I'm sure the rest of the world will realize in about 20-30 years' time. The Erlang people already have, albeit in a different way.)
If I am in the business of system reliability, I will choose the language with shallower rabbit holes.
Abstraction layers are great for builders and terrible for fixers. I am both, so I need to strike a balance.
- Haddock hyperlinked source makes it easy to understand libraries if you need to dig into internals
- ghci makes it easy to interactively learn the language - and a new codebase!
- Haskell can dump the stages of its codegen pipeline (Core, STG, Cmm)
- Profiling and Event logging exist and are easy to use
- You can even write an inspection test to assert certain behavior holds. For instance, that no allocations occur or that some abstraction (e.g. Generic) is truly erased by GHC's optimizations
How does this work in the context of CSS? Do people making websites need to understand how WebKit paints the screen?
The word “effectively” seems rather arbitrary here too.
For example I have seen many having a hard time understanding why it is trivially easy to align an element to the top of the screen but tricky to align something to the bottom of the screen - something which would be symmetric and equally simple in a typical application GUI framework.
But understanding how layouts are generated makes this clear.
[0] https://www.joelonsoftware.com/2002/11/11/the-law-of-leaky-a...
There's no difference in practice either for a sufficiently small dataset.
> in practice there is a right way and a wrong way
Sure, but that's true of all technologies.
Yes, Haskell can't help you escape the limitations of our world — or indeed our hardware — but it doesn't pretend to either.
As a non-Haskell user, just for reference what's "sufficiently small"?
If you were building a website for your local Italian restaurant, what would your needs be? Do you need an ElasticSearch cluster to handle customer menu item queries? Do you need a database at all?
In Haskell's case it's best to avoid lists entirely, as they're _usually_ not the optimal data structure. But best for whom? Does the beginner care that a set operation would be more effective than a list operation for their given use-case?
In my day job, I frequently generate records returned from a database along with local changes to be posted later, and say compute the sum of one of the columns. That sounded like something I'd use folding for, with my limited knowledge, so I was just curious at which point (order of magnitude) I'd have to worry about doing it this way or that.
But if lists are not to be used, what should I use for the above? And will the data structure you propose be fine with either fold?
At this point (taking into account the extent of your knowledge as you yourself described it), my advice would be to just use basic folding and lists. At some point in the future, if you observe some performance issue in exactly that area, you might remember this and think "hmm, memory consumption is bit excessive here; maybe I'll try a foldr instead", or "finding the intersection of these two big lists is a little slow; maybe I'll convert them both to sets instead?"
So what happens in practice with unfortunately large datasets?
>Yes, Haskell can't help you escape the limitations of our world — or indeed our hardware — but it doesn't pretend to either
Then what is Haskell's value-proposition when it comes to solving real-world problems?
You take a different approach. Haskell provides plenty of options.
> Then what is Haskell's value-proposition when it comes to solving real-world problems?
There are many. You can consult your favourite search engine to learn more.
So do other languages. Why is Haskell special in this regard?
>There are many. You can consult your favourite search engine to learn more.
None that seem to address the problem of diminishing returns.
I never suggested other programming languages don’t also have value. Again, if you want to educate yourself further on a specific technology’s benefits, I invite you to make use of a search engine instead of sea-lioning on a technical forum.
> None that seem to address the problem of diminishing returns.
That’s your opinion. Nobody is forcing you to like Haskell. You are free to just ignore it.