Send Beginners mailing list submissions to beginners@haskell.org To subscribe or unsubscribe via the World Wide Web, visit http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners or, via email, send a message with subject or body 'help' to beginners-requ...@haskell.org
You can reach the person managing the list at beginners-ow...@haskell.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Beginners digest..." Today's Topics: 1. Re: My Continuation doesn't typecheck (martin) 2. My Continuation doesn't typecheck (Kim-Ee Yeoh) ---------------------------------------------------------------------- Message: 1 Date: Mon, 8 Aug 2016 16:40:00 +0200 From: martin <martin.drautzb...@web.de> To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level topics related to Haskell <beginners@haskell.org> Subject: Re: [Haskell-beginners] My Continuation doesn't typecheck Message-ID: <57a899c0....@web.de> Content-Type: text/plain; charset=utf-8 Am 08/07/2016 um 05:18 PM schrieb Kim-Ee Yeoh: > Have you heard of Djinn? > > https://hackage.haskell.org/package/djinn > > If you punch in the signature of the combine function you're looking for > (rewritten more usefully in Kleisli composition > form): > > (Int -> (Integer->r) -> r) -> > (Integer -> (String -> r) -> r) -> > (Int -> (String -> r) -> r) > Thanks for pointing out Djinn, but I want to understand. And there are a number of things I don't understand. Maybe you can help me out: (1) what is the "more useful Kleisli composition" and what would be "less useful" ? (2) I was hoping my experiments would eventually make the Cont monad appear and I originally even named my combinator 'bind' instead of 'combine'. My hope was fueled by the observation that combine a f g = f a g works with f substitued with f1 :: Int -> (Integer->r) -> r and g substitued with f2 :: Integer -> (String -> r) -> r 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 f1 :: Int -> C r Integer f2 :: Integer -> C r String Now my 'combine' function seems to be different from 'bind' (>>=). It also just too simple to be true. Somwhere I am making a fundamental mistake, but I cannot quite see it. ------------------------------ Message: 2 Date: Mon, 8 Aug 2016 22:32:38 +0700 From: Kim-Ee Yeoh <k...@atamo.com> To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level topics related to Haskell <beginners@haskell.org> Subject: [Haskell-beginners] My Continuation doesn't typecheck Message-ID: <capy+zdsah8fqjszdyuaiycbu0kac7-kp4tfvna+ndy__2zo...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" > > (1) what is the "more useful Kleisli composition" and what would be "less > useful" ? This type signature (Int -> (Integer->r) -> r) -> (Integer -> (String -> r) -> r) -> (Int -> (String -> r) -> r) is the Cont monad instantiation of (>=>) :: Monad <http://hackage.haskell.org/package/base-4.9.0.0/docs/Control-Monad.html#t:Monad> m => (a -> m b) -> (b -> m c) -> a -> m c See http://hackage.haskell.org/package/base-4.9.0.0/docs/ Control-Monad.html#v:-62--61--62- Being more uniform, this signature is more useful than the one you had earlier worked with: combine :: Int -> (Int -> (Integer->r) -> r) -> -- f1 (Integer -> (String -> r) -> r) -> -- f2 ((String -> r) -> r) > Now my 'combine' function seems to be different from 'bind' (>>=). It also just too simple to be true. You got Kleisli composition, although not monadic bind. That's still a win of sorts. Best, Kim-Ee Yeoh On Monday, August 8, 2016, martin <martin.drautzb...@web.de <javascript:_e(%7B%7D,'cvml','martin.drautzb...@web.de');>> wrote: > Am 08/07/2016 um 05:18 PM schrieb Kim-Ee Yeoh: > > Have you heard of Djinn? > > > > https://hackage.haskell.org/package/djinn > > > > If you punch in the signature of the combine function you're looking for > (rewritten more usefully in Kleisli composition > > form): > > > > (Int -> (Integer->r) -> r) -> > > (Integer -> (String -> r) -> r) -> > > (Int -> (String -> r) -> r) > > > > Thanks for pointing out Djinn, but I want to understand. And there are a > number of things I don't understand. Maybe you > can help me out: > > (1) what is the "more useful Kleisli composition" and what would be "less > useful" ? > (2) I was hoping my experiments would eventually make the Cont monad > appear and I originally even named my combinator > 'bind' instead of 'combine'. My hope was fueled by the observation that > > > combine a f g = f a g > > works with > f substitued with f1 :: Int -> (Integer->r) -> r and > g substitued with f2 :: Integer -> (String -> r) -> r > > 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 > > f1 :: Int -> C r Integer > f2 :: Integer -> C r String > > Now my 'combine' function seems to be different from 'bind' (>>=). It also > just too simple to be true. > > Somwhere I am making a fundamental mistake, but I cannot quite see it. > > > _______________________________________________ > Beginners mailing list > Beginners@haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners > -- -- Kim-Ee -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.haskell.org/pipermail/beginners/attachments/20160808/d23fb1e6/attachment-0001.html> ------------------------------ Subject: Digest Footer _______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners ------------------------------ End of Beginners Digest, Vol 98, Issue 10 *****************************************