<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:large">  hello,<br>i still seaching a good monad example and after passed the classic<br>tutorial about Maybe monad or State monad which is found in almost 90%<br>of the litterature i try to learn in deep the example of monad that<br>talk about probability (<br><a href="http://learnyouahaskell.com/for-a-few-monads-more">http://learnyouahaskell.com/for-a-few-monads-more</a> )<br>for this i try to trace the calls of the inner monad definition like in<br>the file, i give the file in attachment (monade.hs) and the output has<br>a lot of garbage data, not the nicer way to display it,sorry.<br><br>What i can not figure out is at what stage the program construct the <br><br>[Tails,Heads] , [Heads,Heads] ... etc<br><br>i do not know,<br> if someone could explain me in detail the action of<br><br>a <- coin  <br>b <- loadedCoin  <br>return [a,b]<br><br>step by step it would be of great help...<br><br>Regards,<br>Damien<br><br>note:<br>here is the ouput:<br><br>*Main> :load monade.hs<br>[1 of 1] Compiling Main             ( monade.hs, interpreted )<br>Ok, one module loaded.<br>*Main> flipTwoVal<br>Prob {getProb =  (Monad Prob >>= <br> flatten <br>  (fmap f m)<br>  Functor Prob <br>      Functor Prob (f x,1 % 2)<br>   flatten multAll map ... p= 1 % 2 <br> (Monad Prob >>= <br> flatten <br>  (fmap f m)<br>  Functor Prob <br>      Functor Prob (f x,1 % 10)<br>   flatten multAll map ... p= 1 % 10 <br> Monad Prob return) <br>[       flatten multAll (1 % 10*1 % 1) <br>       flatten multAll (1 % 2*1 % 10) <br>([Heads,Heads],1 % 20)      Functor Prob (f x,9 % 10)<br>   flatten multAll map ... p= 9 % 10 <br> Monad Prob return) <br>,       flatten multAll (9 % 10*1 % 1) <br>       flatten multAll (1 % 2*9 % 10) <br>([Heads,Tails],9 % 20)      Functor Prob (f x,1 % 2)<br>   flatten multAll map ... p= 1 % 2 <br> (Monad Prob >>= <br> flatten <br>  (fmap f m)<br>  Functor Prob <br>      Functor Prob (f x,1 % 10)<br>   flatten multAll map ... p= 1 % 10 <br> Monad Prob return) <br>,       flatten multAll (1 % 10*1 % 1) <br>       flatten multAll (1 % 2*1 % 10) <br>([Tails,Heads],1 % 20)      Functor Prob (f x,9 % 10)<br>   flatten multAll map ... p= 9 % 10 <br> Monad Prob return) <br>,       flatten multAll (9 % 10*1 % 1) <br>       flatten multAll (1 % 2*9 % 10) <br>([Tails,Tails],9 % 20)]}<br>*Main> flipTwoVal<br>Prob {getProb = [([Heads,Heads],1 % 20),([Heads,Tails],9 %<br>20),([Tails,Heads],1 % 20),([Tails,Tails],9 % 20)]}<br></div></div></div></div></div>