<p dir="ltr">Indeed, the question is not wherever it's a monad or not, just to what extent is the monad useful.</p>
<br><div class="gmail_quote"><div dir="ltr">Dne po 11. 7. 2016 22:08 uživatel Olaf Klinke <<a href="mailto:olf@aatal-apotheke.de">olf@aatal-apotheke.de</a>> napsal:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">As someone else on this list whose name I don't recall put it, there is no<br>
choice on whether to make Stream a monad or not. It simply _is_ a monad.<br>
Anyone with some CS education hearing 'diagonal of inifinite list of<br>
infinite lists' should immediately think of Georg Cantor.<br>
<br>
import Data.Stream<br>
import Data.Ratio<br>
<br>
type Real = Stream Rational<br>
-- approximate a real number by an ascending stream<br>
-- of lower bounds.<br>
<br>
supremum :: Stream Real -> Real<br>
supremum  = join<br>
-- If a stream of reals is index-wise ascending,<br>
-- the monad instance for Stream computes its supremum.<br>
-- Use this e.g. to compute any mathematical quantity<br>
-- defined as a supremum.<br>
<br>
-- Olaf<br>
</blockquote></div>