Lesson plan
Option type
In programming languages (especially functional programming languages) and type theory, an option type or maybe type is a polymorphic type that represents encapsulation of an optional value; e.g., it is used as the return type of functions which may or may not return a meaningful value when they are applied. It consists of a constructor which either is empty (often named None or Nothing ), or which encapsulates the original data type A (often written Just A or Some A ). A distinct, but related concept outside of functional programming, which is popular in object-oriented programming, is called nullable types (often expressed as A? ). The core difference between option types and nullable types is that option types support nesting (e.g. Maybe (Maybe String) ≠ Maybe String ), while nullable types do not (e.g. String?? = String? ).
Article summary
In programming languages (especially functional programming languages) and type theory, an option type or maybe type is a polymorphic type that represents encapsulation of an optional value; e.g., it is used as the return type of functions which may or may not return a meaningful value when they are applied. It consists of a constructor which either is empty (often named None or Nothing ), or which encapsulates the original data type A (often written Just A or Some A ). A distinct, but related concept outside of functional programming, which is popular in object-oriented programming, is called nullable types (often expressed as A? ). The core difference between option types and nullable types is that option types support nesting (e.g. Maybe (Maybe String) ≠ Maybe String ), while nullable types do not (e.g. String?? = String? ).
Key claims
No claims recorded.
Discussion questions
- Summarise the article in your own words. Which single claim would you verify first, and why?
- Which claim in this article is most likely to be revised as the sources update? How would you check its current status?
- If two sources disagreed about one of these facts, what would you need in order to trust one over the other?
Bibliography
No sources recorded.
Key claims and bibliography are generated from the same tracked claims and sources as the article page.