Skip to content

Latest commit

 

History

History
21 lines (16 loc) · 417 Bytes

intersections.md

File metadata and controls

21 lines (16 loc) · 417 Bytes
id title
intersections
Intersections

Intersections

Intersections in programming define a type that must encompass all the constituents of the intersection. You can declare an intersection using the & operator.

alias Dog = Animal & Pet;

An intersection is functionally equivalent to spreading both types.

alias Dog = {
  ...Animal;
  ...Pet;
};