It was one of those wonderful things that you think will only take 5 minutes, and frankly it should. But no. As I have proven time and time and time again in the past few weeks, I’m lousy at estimating time. Though generally it’s of the genre of “just 30 more minutes and I’ll be at a stopping point… hey, wait, when did the sun come up?”
The task was simple: > add a section for the strongest earthquakes from the past 24 hours
And the implementation was theoretically easy enough. Instead of passing all of the earthquakes from the model, I’d instead pre-process it first to send it the result of this:
model.earthquakes
|> List.sortBy .magnitude
|> List.reverse
|> List.take 5
But since I still don’t have my head wrapped around Maybe
and Nothing
, my function to actually view the earthquake table was expecting it might be Nothing
but I was just sending it a straight List
.
Well, since I still don’t really know wtf I’m doing, instead of setting earthquakes = Nothing
in the model, I changed it to earthquakes = []
, so now it’s always a List
, it might just be an empty list.
In the end, it wasn’t that difficult, but I’m still bugged af about the fact that I don’t understand Maybe
s at all. I continue to get tripped up by them. And technically in this case, I learned nothing. I just learned how to rip a Maybe
out and replace it with something else.