<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><font size="2"><span style="background-color:rgba(255,255,255,0)">(1) what is the "more useful Kleisli composition" and what would be "less useful" ?</span></font></blockquote><div><br></div>This type signature<br><br><font size="2"><span style="background-color:rgba(255,255,255,0)"> (Int -> (Integer->r) -> r) -><br> (Integer -> (String -> r) -> r) -><br> (Int -> (String -> r) -> r)<br></span></font><br>is the Cont monad instantiation of<div><a style="margin:0px;padding:0px;font-weight:bold"><br></a></div><div><a style="margin:0px;padding:0px;font-weight:bold">(>=>)</a><span style="background-color:rgba(255,255,255,0);font-size:small"> </span><span style="background-color:rgba(255,255,255,0);font-size:small">::</span><span style="background-color:rgba(255,255,255,0);font-size:small"> </span><a href="http://hackage.haskell.org/package/base-4.9.0.0/docs/Control-Monad.html#t:Monad" style="margin:0px;padding:0px;text-decoration:underline" target="_blank">Monad</a><span style="background-color:rgba(255,255,255,0);font-size:small"> </span><span style="background-color:rgba(255,255,255,0);font-size:small">m => (a -> m b) -> (b -> m c) -> a -> m c</span><div><div style="margin:0px;padding:0px 0px 0px 2em"></div></div><div><br></div><div>See</div><div><br></div><div><a href="http://hackage.haskell.org/package/base-4.9.0.0/docs/Control-Monad.html#v:-62--61--62-" target="_blank">http://hackage.haskell.org/<wbr>package/base-4.9.0.0/docs/<wbr>Control-Monad.html#v:-62--61--<wbr>62-</a></div><div><br></div><div>Being more uniform, this signature is more useful than the one you had earlier worked with:</div><div><br></div><div><font size="2"><span style="background-color:rgba(255,255,255,0)">combine :: Int -><br> (Int -> (Integer->r) -> r) -> -- f1<br> (Integer -> (String -> r) -> r) -> -- f2<br> ((String -> r) -> r)</span></font><br></div><div><br></div><div><font size="2"><span style="background-color:rgba(255,255,255,0)">> Now my 'combine' function seems to be different from 'bind' (>>=). It also just too simple to be true.</span></font><br></div><div><br></div><div>You got Kleisli composition, although not monadic bind. That's still a win of sorts.</div><div><br></div>Best, Kim-Ee Yeoh<br><div><br></div><div>On Monday, August 8, 2016, martin <<a href="javascript:_e(%7B%7D,'cvml','martin.drautzburg@web.de');" target="_blank">martin.drautzburg@web.de</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Am 08/07/2016 um 05:18 PM schrieb Kim-Ee Yeoh:<br>
> Have you heard of Djinn?<br>
><br>
> <a href="https://hackage.haskell.org/package/djinn" target="_blank">https://hackage.haskell.org/pa<wbr>ckage/djinn</a><br>
><br>
> If you punch in the signature of the combine function you're looking for (rewritten more usefully in Kleisli composition<br>
> form):<br>
><br>
> (Int -> (Integer->r) -> r) -><br>
> (Integer -> (String -> r) -> r) -><br>
> (Int -> (String -> r) -> r)<br>
><br>
<br>
Thanks for pointing out Djinn, but I want to understand. And there are a number of things I don't understand. Maybe you<br>
can help me out:<br>
<br>
(1) what is the "more useful Kleisli composition" and what would be "less useful" ?</blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
(2) I was hoping my experiments would eventually make the Cont monad appear and I originally even named my combinator<br>
'bind' instead of 'combine'. My hope was fueled by the observation that<br>
<br>
<br>
combine a f g = f a g<br>
<br>
works with<br>
f substitued with f1 :: Int -> (Integer->r) -> r and<br>
g substitued with f2 :: Integer -> (String -> r) -> r<br>
<br>
As a next step I would have wrapped (b->r) -> r in a newtype C r b and my functions f1 and f2 would have had the types<br>
<br>
f1 :: Int -> C r Integer<br>
f2 :: Integer -> C r String<br>
<br>
Now my 'combine' function seems to be different from 'bind' (>>=). It also just too simple to be true.<br>
<br>
Somwhere I am making a fundamental mistake, but I cannot quite see it.<br>
<br>
<br>
______________________________<wbr>_________________<br>
Beginners mailing list<br>
<a>Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" target="_blank">http://mail.haskell.org/cgi-bi<wbr>n/mailman/listinfo/beginners</a><br>
</blockquote></div></div>
<br><br>-- <br>-- Kim-Ee<br>