|
|
|
|
|
by mechanical_fish
5434 days ago
|
|
Haskell is compiled. As I understand it, much of the point of Maybe is that it provides a formal language for expressing and manipulating unhandled edge cases. Then the compiler can spot those unhandled edge cases at compile time and make sure you handle them at one level of scope or another. In Ruby the concept seems less useful because there is no compiler. |
|
1. A "null" instance of one type should not be conflated with a "null" instance of a separate type. 2. By type-wrapping in a Maybe, you declare where you need to be able to handle nulls and where you are free to ignore them (but can never pass them in). You confine the null to specific regions of your code. 3. You force your code's clients to think about the null case wherever you make it visible.