In Haskell, a Maybe type can be either a Nothing or a Just a
data Maybe = Nothing | Just a
If we call Maybe Union Type, what is Nothing then? a Type? No, it's not a type, you can't declare a variable to be Nothing type.
Maybe you would say type constructor, true, but I want to express the fact that Nothing and Just are different cases.
a type value? a type instance? a type case?
It is a data constructor. Since it has no arguments, it is also called a constant and nullary data constructor.
These data constructors group values (well here there are no values) together, together with a tag: some sort of identifier that identifies that it is a Nothing, and not a Just.
Nothing is also called a "case" of the "variant" (or "variant type") Maybe a. This terminology is used more frequently in OCaml than in Haskell, e.g., Real World OCaml chapter of variants (I don't know what is common in other languages).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With