https://github.com/tomjaguarpaw/haskell-opaleye/blob/master/...
For someone who knows Haskell idioms this is extremely readable compared to functionally equivalant code in another language.
https://github.com/tomjaguarpaw/haskell-opaleye/blob/master/...
For someone who knows Haskell idioms this is extremely readable compared to functionally equivalant code in another language.
However, I'm not a haskell pro, so I don't know if I'm just missing the obvious here.
Welcome to the world of Haskell! Sum types aren't even available in C, C++, C#, Java, Python, Ruby, JavaScript, ..., so I think you're just proving my point for me.
https://github.com/databrary/databrary/blob/master/Databrary...
with gems like
https://github.com/databrary/databrary/blob/master/Databrary...
and
https://github.com/databrary/databrary/blob/master/Databrary...
and
https://github.com/databrary/databrary/blob/master/Databrary...
and
https://github.com/databrary/databrary/blob/master/Databrary...
That said... looking at your first example, it's really not that bad. It could probably be rewritten to be quite a bit clearer, but even knowing nothing about the library or surrounding context, it doesn't take me that much thinking to work out what's going on:
We have a dictionary implemented as a sorted list of pairs, and a list of records we want to update that dictionary with (after some transformation).
If there are no records, we give back the dictionary unmodified. If there is no dictionary, we build one out of the records. If there is both a dictionary and a bunch of records, we do a recursive merge of the two - compare the heads of each list, cons the smaller on the result of the appropriate recursive call.
That's exactly what I was asked to do!
https://hackage.haskell.org/package/turtle-1.3.6/docs/src/Tu...