<div dir="ltr"><div>Hi Everyone,</div><div><br></div><div>In most user-interfaces we need special-treatment for blank states (zero-item state). For example:</div><div><br></div><div>* In case there are no customers, don't show an empty table, instead show the message "You seem to have no customers, why not start by creating one..."</div><div>* In case there are no bookings, don't show an empty table, instead show the message, "No bookings here. Want to create one?"</div><div>* In case there are no search results, don't show an empty table, instead show the message, "No items found. Undo your last filter?"</div><div><br></div><div>In some cases, the one-item case also needs special treatment, but I'm unable to come with relatable examples at the moment.</div><div><br></div><div>A lot of times the dev simply forgets about the blank state, and it is caught during QA, which results in a quick-fix on the following lines:</div><div><br></div><div>    if length item > 0 then displayTable else showBlankState</div><div>    if Data.Map.Strict.size map > 0 then displayTable else showBlankState</div><div>    if Data.Set.Ordered.size set > 0 then displayTable else showBlankState</div><div><br></div><div>Is there a way to prevent this bug from the get-go? Can we use the type-system (or anything else) to enforce the dev to at least _think_ about the blank state? Obviously, the type system can't help us with _what_ needs to be done with the blank state, but at least it can _remind_ the dev at compile-time about handling blank states.</div><div><br></div><div>-- Saurabh.</div>
</div>