{ super(value); } public <R> Monad<R> map(Function<T,R> fun) { return new Monad<R>(fun.apply((T) this.getValue())); } public <R> Monad<R> flatMap(Function<T, Monad<R>> fun) { return fun.apply((T) this.getValue()); // on retourne la monade sans la remettre dans un container wrapper } } ❌
TinyToon("Ted", ""), new TinyToon("Polo", ""))), new TinyToon("Jane", "", Arrays.asList( new TinyToon("Zed", ""), new TinyToon("Grou", ""))), new TinyToon("Sam", "", Arrays.asList( new TinyToon("Kate", ""), new TinyToon("Nike", ""))), new TinyToon("John", "", Arrays.asList( new TinyToon("Ray", ""), new TinyToon("Zoe", ""))) ); [ [, ], [, ], [, ], [, ] ]