3 ms·
1) Yes, casting. You need to do casting in Haskell too, it's just hidden for you by pattern-matching 2) It's for a hypothetical Java implementation that doesn'
by anon4 13y ago
1) Yes, casting. You need to do casting in Haskell too, it's just hidden for you by pattern-matching
2) It's for a hypothetical Java implementation that doesn't have null
3) If you really want to, make it an abstract class and do a check in the constructor that this.getClass() == Nothing.class or Just.class.
4) see 2)
5) well if you're using primitive types they are non-nullable already
Edit: to clarify, I don't expect someone to use it for Java today, it's what I would put in the standard library if Java didn't have a null in the first place.