Skip to content

monad-like return type for Rewriter::rewrite #14

@lueck

Description

@lueck

It would be desirable, if we could declare a monadic return type on Rewriter::rewrite with a type parameter, M<P2>; and then use, e.g., the identity monad for normalizers, the list monad for forward mappers, the maybe monad java.util.Optional for reverse mappers.

However, that cannot be expressed in the Java type system. Can it?

That does not compile:

public interface Rewriter<M<?>, R extends Resource<?>, P1 extends Point, P2 extends Point> {

    public M<P2> rewrite(R resource, P1 position, RewriterConfig config) throws SelectorException;

}

Assignees: @lueck

Migrated from GitLab: https://zivgitlab.uni-muenster.de/SCDH/selectors/selection-engine/-/issues/14

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions