Skip to content

Commit 71c637b

Browse files
committed
Add Void: a logically uninhabited data type. Fix #193
1 parent ab9672b commit 71c637b

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

core/src/main/java/fj/Void.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package fj;
2+
3+
/**
4+
* A logically uninhabited data type.
5+
*/
6+
public abstract class Void {
7+
8+
private Void() {
9+
throw new IllegalStateException("Void cannot be instantiated");
10+
}
11+
12+
/**
13+
* Since Void values logically don't exist, this witnesses the logical reasoning tool of "ex falso quodlibet".
14+
*/
15+
public abstract <X> X absurd();
16+
}

0 commit comments

Comments
 (0)