Comment

Comment by yen223

If x represented a set with some values

  x = {RED, GREEN, BLUE}
It would be really swell if the optional type `Maybe x` were a strict superset:

  Maybe x = {RED, GREEN, BLUE, None}
This means functions that map `Maybe x -> y` can accept values of type `x` without issue.

But in Haskell (and OCaml) it's not. What we actually have is something more like

  Maybe x = {Some(RED), Some(GREEN), Some(BLUE), None}
which is a totally different set from `x`, which is why functions which shouldn't break, ultimately do.
parent yen223 8 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton