After sticking to "true" and "false" being "1" and "nil" for the entire project I'm adding explicit true/false & I'm sad I'm no longer LISP
-
Show this thread
-
Sorta half considering going the other way, never adding "null", and using "false" as the null value
3 replies 1 retweet 5 likesShow this thread -
Replying to @mcclure111
Drop null, have sum types to make something "false-or(type)" if needed. Only sane choice.
2 replies 0 retweets 2 likes -
Replying to @andreasdotorg
Agreed. The question is should the "or" be "false" or something like an explicit "null".
1 reply 0 retweets 0 likes -
Replying to @mcclure111
False, in my mind. Because what would be the type of "null"?
1 reply 0 retweets 0 likes -
Replying to @andreasdotorg
NullType. For two reasons (1) I don't want null to be falsy (2) I want it to be possible to have a variable of type "boolean option"
2 replies 0 retweets 1 like -
Replying to @mcclure111
Fair enough. I guess it doesn't matter too much as long as you got proper sum types. (Also, now thinking about Option monad...)
1 reply 0 retweets 0 likes -
Replying to @andreasdotorg
I'm gonna be honest. I have never really understood how you use monads, practically speaking
1 reply 0 retweets 0 likes -
Replying to @mcclure111
In this case, pretty easy. Say you have an operation that returns X or null. And you want to pipe that into a function taking an X and ...
1 reply 0 retweets 0 likes -
Replying to @andreasdotorg @mcclure111
Returning an X or null. Of course, if the first function already returned null, you don't even want to call the second.
1 reply 0 retweets 0 likes
An option monad is just that: a container for "X or null" and a way to call a function taking an X when given an "X or null".
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.