Staying sane with Maybe (maybe vs type)

I think you should prefer a Maybe, rather than default data. As default data just hides potential issues and mute errors. I think you should make it obvious that you are missing something, and push it until the very end to deal with that e.g. show an empty view.

Maybes are fine. Your own descriptive custom type is better.
I recommend not reaching for withDefault early. Try to use Maybe.withDefault at the very end, e.g. in the view that needs to show something.

1 Like