4 ms·
Value isn't set? Use Nothing. Data has been collected and the user didn't input anything? Use Just "". If you really wanted to, in Haskell you could do somethi
by claudiawerner 7y ago
Value isn't set? Use Nothing. Data has been collected and the user didn't input anything? Use Just "".
If you really wanted to, in Haskell you could do something like:
data AdvancedMaybe a = Just a | Nothing | PassiveNothing
- sammorrowdrums 7y agoInteresting example. I certainly think the just use empty "" is fine and the coercion to NULL is not great. I think Allowing "empty" values, and not allowing Null would be better. If SQL had Option (Maybe) branch matching it would be an interesting replacement, and then coalesce would not be needed. SELECT id, MATCH k WITH ( SOME(k) THEN k, NONE THEN default, END) AS something FROM ... I can see it's terse, and it is just a wrapper around data that would be stored like NULL but it kind of makes for interesting semantics. Just spitballing for fun on what it might look like.