Monads/Writer monad: Difference between revisions

Content added Content deleted
Line 439: Line 439:


println("$a => $b => $c")
println("$a => $b => $c")
println(bind(f2, "after plus 8", bind(f1, "after times 7", unit(3, "after intialization"))))
</lang>{{out}}
</lang>{{out}}
<pre>
<pre>
after intialization: 3 => after intialization, after times 7: 21 => after intialization, after times 7, after plus 8: 29
after intialization: 3 => after intialization, after times 7: 21 => after intialization, after times 7, after plus 8: 29
after intialization, after times 7, after plus 8: 29
</pre>
</pre>