Another use case for Never
is with phantom types.
type Point coordinateSystem = Point Float Float
type WorldCoordinate = WorldCoordinate Never
type ScreenCoordinate = ScreenCoordinate Never
playerStartPos : Point WorldCoordinate
playerStartPos = Point 2 3
healthBarPos : Point ScreenCoordinate
healthBarPos = Point 200 10
Here I’ve defined Point
that uses a type parameter to make sure I don’t mix up different coordinate systems. I don’t actually want to create an instance of these coordinate systems though, they are just being used as phantom types. So to prevent accidentally creating them I add Never to their constructor.