Skip to content

Commit

Permalink
Correct typo
Browse files Browse the repository at this point in the history
  • Loading branch information
ploeh committed Mar 29, 2024
1 parent 08feb00 commit b1c29a8
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ <h3 id="4f0b84e839d54f16af37d0295140dc17">
Now, instead of diminishing the domain, we expand the codomain by allowing the return value to be null. (Interestingly, this is the inverse of <a href="/2021/12/06/the-liskov-substitution-principle-as-a-profunctor">my profunctor description of the Liskov Substitution Principle</a>. I don't yet know what to make of that. See: Just by writing things down, I learn something I hadn't realized before.)
</p>
<p>
This is beneficial in a statically typed language, because such a change makes hidden knowledge explicit. It makes it so explicit that a type checker can point out when we make mistakes. <a href="https://blog.janestreet.com/effective-ml-video/">Make illegal states unrepresentable</a>. <a href="https://en.wikipedia.org/wiki/Poka-yoke">Poka-yoke</a>. A potential run-time is now a compile-time error, and it's firmly in the category of errors that we've predicted and decided to handle.
This is beneficial in a statically typed language, because such a change makes hidden knowledge explicit. It makes it so explicit that a type checker can point out when we make mistakes. <a href="https://blog.janestreet.com/effective-ml-video/">Make illegal states unrepresentable</a>. <a href="https://en.wikipedia.org/wiki/Poka-yoke">Poka-yoke</a>. A potential run-time exception is now a compile-time error, and it's firmly in the category of errors that we've predicted and decided to handle.
</p>
<p>
In the above example, we could use the built-in .NET <a href="https://learn.microsoft.com/dotnet/api/system.nullable-1">Nullable&lt;T&gt;</a> (with the <code>?</code> syntactic-sugar alias). In other cases, you may resort to returning a <a href="/2018/03/26/the-maybe-functor">Maybe</a> (AKA <em>option</em>).
Expand Down

0 comments on commit b1c29a8

Please sign in to comment.