Re: [Haskell-cafe] A handy little consequence of the Cont monad

2008-02-04 Thread Philip Armstrong
On Fri, Feb 01, 2008 at 10:19:17PM +, Lennart Augustsson wrote: It's a matter of taste. I prefer the function composition in this case. It reads nicely as a pipeline. (Hoping not to contribute to any flamage...) I've always liked $ for this kind of code, if you want to keep the

Re: [Haskell-cafe] A handy little consequence of the Cont monad

2008-02-04 Thread Cale Gibbard
On 04/02/2008, Philip Armstrong [EMAIL PROTECTED] wrote: I've always liked $ for this kind of code, if you want to keep the arguments around: next xs = runCont $ sequence $ map Cont xs seems quite natural to me. I'd probably write that as nest xs = runCont . sequence . map Cont $ xs

Re: [Haskell-cafe] A handy little consequence of the Cont monad

2008-02-04 Thread Derek Elkins
On Mon, 2008-02-04 at 16:56 -0500, Cale Gibbard wrote: On 04/02/2008, Philip Armstrong [EMAIL PROTECTED] wrote: I've always liked $ for this kind of code, if you want to keep the arguments around: next xs = runCont $ sequence $ map Cont xs seems quite natural to me. I'd

Re: [Haskell-cafe] A handy little consequence of the Cont monad

2008-02-01 Thread Henning Thielemann
On Fri, 1 Feb 2008, Cale Gibbard wrote: Hello, Today on #haskell, resiak was asking about a clean way to write the function which allocates an array of CStrings using withCString and withArray0 to produce a new with* style function. I came up with the following: nest :: [(r - a) - a] -

Re: [Haskell-cafe] A handy little consequence of the Cont monad

2008-02-01 Thread Derek Elkins
On Fri, 2008-02-01 at 00:09 -0500, Cale Gibbard wrote: Hello, Today on #haskell, resiak was asking about a clean way to write the function which allocates an array of CStrings using withCString and withArray0 to produce a new with* style function. I came up with the following: nest ::

Re: [Haskell-cafe] A handy little consequence of the Cont monad

2008-02-01 Thread Dan Licata
Not to start a flame war or religious debate, but I don't think that eta-expansions should be considered bad style. I realize that composition-style is good for certain types of reasoning, but fully eta-expanded code has an important legibility advantage: you can tell the shape of its type just

Re: [Haskell-cafe] A handy little consequence of the Cont monad

2008-02-01 Thread Lennart Augustsson
It's a matter of taste. I prefer the function composition in this case. It reads nicely as a pipeline. -- Lennart On Fri, Feb 1, 2008 at 9:48 PM, Dan Licata [EMAIL PROTECTED] wrote: Not to start a flame war or religious debate, but I don't think that eta-expansions should be considered bad

Re: [Haskell-cafe] A handy little consequence of the Cont monad

2008-02-01 Thread Derek Elkins
On Fri, 2008-02-01 at 16:48 -0500, Dan Licata wrote: Not to start a flame war or religious debate, but I don't think that eta-expansions should be considered bad style. I realize that composition-style is good for certain types of reasoning, but fully eta-expanded code has an important

Re: [Haskell-cafe] A handy little consequence of the Cont monad

2008-02-01 Thread Conor McBride
Folks On 1 Feb 2008, at 22:19, Lennart Augustsson wrote: It's a matter of taste. I prefer the function composition in this case. It reads nicely as a pipeline. -- Lennart Dan L : On Fri, Feb 1, 2008 at 9:48 PM, Dan Licata [EMAIL PROTECTED] wrote: Not to start a flame war or

Re: [Haskell-cafe] A handy little consequence of the Cont monad

2008-02-01 Thread Don Stewart
derek.a.elkins: On Fri, 2008-02-01 at 16:48 -0500, Dan Licata wrote: Not to start a flame war or religious debate, but I don't think that eta-expansions should be considered bad style. I realize that composition-style is good for certain types of reasoning, but fully eta-expanded code

Re[2]: [Haskell-cafe] A handy little consequence of the Cont monad

2008-02-01 Thread Bulat Ziganshin
Hello Conor, Saturday, February 2, 2008, 1:29:02 AM, you wrote: nest = ala Cont traverse id Third-order: it's a whole other order. oh! i remember faces of my friends when i showed them something like sortOn snd . zip [0..]. probably i have the same face now :))) -- Best regards, Bulat

[Haskell-cafe] A handy little consequence of the Cont monad

2008-01-31 Thread Cale Gibbard
Hello, Today on #haskell, resiak was asking about a clean way to write the function which allocates an array of CStrings using withCString and withArray0 to produce a new with* style function. I came up with the following: nest :: [(r - a) - a] - ([r] - a) - a nest xs = runCont (sequence (map