Hacker News new | past | comments | ask | show | jobs | submit login

> Instead of two ints, now your function takes two maybe-ints and crashes at runtime if they're not there.

The idea in Haskell (and many more, I'm sure), is that if you take a maybe-int, you can't get the int without unpacking it (or using a function that only operates on the int if its there), so then when you pass the unpacked int around, you are 100% sure it's there at all times. No worrying about a JS-style undefined, or some other function altering the value to become null again. It's a guarantee, which is a huge part of why all this FP stuff is so great.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: