Maybe
class:Nothing
constructor has no fields, it is not a function, it's a constant, that can assume the type Maybe a
for any choice of a
.Vector
class defined like so:Shape
example once again. Suppose we have facilities for rendering circles and rectangles and we need to render general Shape
s. This can be accomplished with a simple case expression:case ... of
we need to provide the object which identity we need to discover and then we provide a series of clauses, each providing a return value to use in the case of the particular constructor.