The absurd function

Episode Clip • Apr 5, 2023

Do you think it’s possible to define a function of the form (Never) -> A for any type A? That seems impossible since Never is a type in Swift that cannot be constructed. It has no values whatsoever.

Well, it is possible to construct such a function, and it’s a little absurd. This video is an excerpt from our episode on the connection between Swift’s type system and exponentiation from algebra.

Get started with our free plan

Our free plan includes 1 subscriber-only episode of your choice, access to 62 free episodes with transcripts and code samples, and weekly updates from our newsletter.

View plans and pricing