News for hackers. Stuff that matters.
Re:What Is Good About Haskell? by yakshaving_jgt on Thursday October 03, 2019 @05:26PM (#21152407)
From the example you gave, it seems like we're talking past each other.

The systems I write also have to deal with JSON with nullable fields, and with fields I ignore while parsing. Aeson for instance gives you complete control over how strict or lenient you wish to be when trying to parse data.

The idea I was trying to convey was that if you care about marshalling data into types a la Haskell, then you can code less defensively when writing code for the data you actually care about. You do that defensive validation in just one place, as opposed to sprinkling nil checks all throughout your system.

If I'm understanding your system correctly, it sounds like you have unreliable input, and you want the same output, only with some of the fields updated if they're there. Haskell readily lets you do this too. The lens-aeson library is perfect for this.

Lots of examples for that here: https://www.snoyman.com/blog/2017/05/playing-with-lens-aeson

Also, I am not sure how you differentiate between a null value and no value, but whatever mechanism you're using you could also use to model those two different types of null as actual types in Haskell.

> Oh, that would be wonderful. I dream to live in that world. But that doesn't seem to be the reality I occupy.

It's hard[er] to discern tone through the medium of text, but it sounds like you're suggesting Haskellers live in some fantasy world where all the data is perfect and everything is pure.

I don't really understand that perspective. I make 100% of my income from writing online business software in Haskell. I employ other programmers to write Haskell for me too. We live in the same world you live in, but we might just approach it differently.

There are no comments on this comment yet.