Damien Mattei damien.mattei at gmail.com
Wed Apr 17 14:06:12 UTC 2019

```  hello,
i still seaching a good monad example and after passed the classic
of the litterature i try to learn in deep the example of monad that
for this i try to trace the calls of the inner monad definition like in
the file, i give the file in attachment (monade.hs) and the output has
a lot of garbage data, not the nicer way to display it,sorry.

What i can not figure out is at what stage the program construct the

i do not know,
if someone could explain me in detail the action of

a <- coin
return [a,b]

step by step it would be of great help...

Regards,
Damien

note:
here is the ouput:

[1 of 1] Compiling Main             ( monade.hs, interpreted )
*Main> flipTwoVal
Prob {getProb =  (Monad Prob >>=
flatten
(fmap f m)
Functor Prob
Functor Prob (f x,1 % 2)
flatten multAll map ... p= 1 % 2
flatten
(fmap f m)
Functor Prob
Functor Prob (f x,1 % 10)
flatten multAll map ... p= 1 % 10
[       flatten multAll (1 % 10*1 % 1)
flatten multAll (1 % 2*1 % 10)
flatten multAll map ... p= 9 % 10
,       flatten multAll (9 % 10*1 % 1)
flatten multAll (1 % 2*9 % 10)
([Heads,Tails],9 % 20)      Functor Prob (f x,1 % 2)
flatten multAll map ... p= 1 % 2
flatten
(fmap f m)
Functor Prob
Functor Prob (f x,1 % 10)
flatten multAll map ... p= 1 % 10
,       flatten multAll (1 % 10*1 % 1)
flatten multAll (1 % 2*1 % 10)
([Tails,Heads],1 % 20)      Functor Prob (f x,9 % 10)
flatten multAll map ... p= 9 % 10
,       flatten multAll (9 % 10*1 % 1)
flatten multAll (1 % 2*9 % 10)
([Tails,Tails],9 % 20)]}
*Main> flipTwoVal
-------------- next part --------------
An HTML attachment was scrubbed...