Skip to content

Blog

Is Maybe Int More Expressive Than Int in Set Thoery?

This question seems intuitively and undoubtedly correct as long as you have used Maybe Int in your code. The first brief glance brings us that Maybe Int has 1 additional case more than Int as the former could present Nothing but the latter cannot. Hence, the Maybe Int is more expressive than Int.

In this blog, I will try to figure out the anwser with set theory knowledge. However, I should acknowledge the set theory could not solve this question, which might lead you a bit more confusing after reading this blog. It's wrote down to reflect how I thought the problem.

Understand Functions Are Functors

Functions are functors is a basic idea in funcitonal programming. However, the (->) r formats of functions are confusing and misleading, What's worse, affected by imperative language features, there was an misunderstanding about how the original structure is hold by a functor. To be more concrete, this blog talks about the question: why result of fmap (*2) (+100) 1 is 202, not 102?