Using Sum in another post

Using a type from another post

Reusing the definition

The definition post for Sum introduced the two constructors. Here we use them in a second article, and the DeclarationIndex link in this sentence points to the generated API documentation.

def label {α β : Type} : Sum α β → String | .left _ => "left" | .right _ => "right"

Linking back to context

The same idea works in prose: a value can be left or right, and readers can jump back to the definition of Sum whenever they need the original context.

See raw