Elm Language The Never type


Example

The Never type cannot be constructed (the Basics module hasn't exported its value constructor and hasn't given you any other function that returns Never either). There is no value never : Never or a function createNever : ?? -> Never.

This has its benefits: you can encode in a type system a possibility that can't happen. This can be seen in types like Task Never Int which guarantees it will succeed with an Int; or Program Never that will not take any parameters when initializing the Elm code from JavaScript.