monads - Java: How to implement the interface? -
what simplest , workable implementation of interface of m
. , how implement method flatmap
?
public interface m<t> { <u> m<u> flatmap(function<t, m<u>> f); m<t> unit(t t); }
i'm stuck in flatmap
implementation.
m<string> m = new m<string>() { @override public <u> m<u> flatmap(function<string, m<u>> f) { return null; // ? } @override public m<string> unit(string s) { return new m<string>() { @override public <u> m<u> flatmap(function<string, m<u>> f) { return null; // ? } @override public m<string> unit(string s) { return null; // ? } }; } };
Comments
Post a Comment