Module Relude_Void
type t
=
;|
Void(t)
Void.t
is a type for which it is impossible to construct a value. This may sound like a strange concept, but it can be very valuable for indicating at compile time that certain case is unraeachable.For example, the type
result('a, Void.t)
is still aresult
, and you can still do all of the normal result things to it, but you can know for a fact that it can't be anError
, because there would be no way to construct a valid error payload to satisfy theVoid.t
type.
let absurd: t => 'a;
Void.absurd
can be used when you need to provide a function fromVoid.t
to any other type. Because no value of void can be constructed, this function will never actually be called.