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

Popular posts from this blog

Java 8 + Maven Javadoc plugin: Error fetching URL -

css - SVG using textPath a symbol not rendering in Firefox -

order - Notification for user in user account opencart -