run linter

This commit is contained in:
Yadunand Prem
2022-10-06 16:03:08 +08:00
parent 530ef6b71a
commit 132080d451
6 changed files with 25 additions and 16 deletions

View File

@@ -1,4 +1,5 @@
package cs2030s.fp;
/**
* The Action interface that can be called
* on an object of type T to act.

View File

@@ -1,4 +1,5 @@
package cs2030s.fp;
/**
* The Actionable interface that can
* act when given an action.

View File

@@ -1,6 +1,19 @@
package cs2030s.fp;
public abstract class Actually<T> implements Immutatorable<T>, Actionable<T> {
public static <T> Actually<T> ok(T value) {
return new Success<T>(value);
}
public static <T> Actually<T> err(Exception e) {
// It is okay to do an unchecked cast here as failure types don't use
// the value T.
@SuppressWarnings("unchecked")
Actually<T> failure = (Actually<T>) new Failure(e);
return failure;
}
public abstract T unwrap() throws Exception;
public abstract T except(Constant<? extends T> c);
@@ -11,14 +24,6 @@ public abstract class Actually<T> implements Immutatorable<T>, Actionable<T> {
public abstract <R> Actually<R> next(Immutator<Actually<R>, ? super T> immutator);
public static <T> Actually<T> ok(T value) {
return new Success<T>(value);
}
public static <T> Actually<T> err(Exception e) {
Actually<T> failure = (Actually<T>) new Failure(e);
return failure;
}
private static class Success<T> extends Actually<T> {
private final T value;

View File

@@ -1,4 +1,5 @@
package cs2030s.fp;
/**
* The Immutator interface that can transform
* to type T2, an object of type T1.

View File

@@ -1,4 +1,5 @@
package cs2030s.fp;
/**
* The Immutatorable interface that can
* transform when given something that is