Re: [Haskell-cafe] Pointfree composition for higher arity

2010-02-22 Thread Henning Thielemann
On Wed, 17 Feb 2010, Neil Brown wrote: I very often write this too (wanting function composition, but with a two-argument function on the right hand side). The trick I picked up from somewhere is to do: fun = (runFun .) . someFun someDefault I'm not too keen on that, as it seems clumsy.

Re: [Haskell-cafe] Pointfree composition for higher arity

2010-02-20 Thread Matt Hellige
On Fri, Feb 19, 2010 at 10:42 PM, wren ng thornton w...@freegeek.org wrote: Sean Leather wrote: The second option approaches the ideal pointfreeness (or pointlessness if you prefer), but I'd like to go farther: (...) :: (c - d) - (a - b - c) - a - b - d (...) f g x y = f (g x y) infixr 9

Re: [Haskell-cafe] Pointfree composition for higher arity

2010-02-20 Thread wren ng thornton
Matt Hellige wrote: Thanks! I'm glad to know that people have found this approach useful. In cases where it works, I find it somewhat cleaner than families of combinators with (what I find to be) rather obscure names, or much worse, impenetrable sections of (.). We can write the original example

Re: [Haskell-cafe] Pointfree composition for higher arity

2010-02-19 Thread wren ng thornton
Sean Leather wrote: The second option approaches the ideal pointfreeness (or pointlessness if you prefer), but I'd like to go farther: (...) :: (c - d) - (a - b - c) - a - b - d (...) f g x y = f (g x y) infixr 9 ... I go with infixl 8 personally. It seems to play better with some of the

Re: [Haskell-cafe] Pointfree composition for higher arity

2010-02-18 Thread Bas van Dijk
On Wed, Feb 17, 2010 at 10:23 PM, Sean Leather leat...@cs.uu.nl wrote: -- oo :: (c - d) - (a - b - c) - a - b - d oo :: (Category cat) = cat c d - (a - cat b c) - a - cat b d oo = (.) . (.) I think at NL-FP day 2008 at Utrecht somebody called '(.) . (.)' the 'boob' operator... it was late and

[Haskell-cafe] Pointfree composition for higher arity

2010-02-17 Thread Sean Leather
I find myself often writing this pattern: someFun x y z = ... fun y z = runFun $ someFun someDefault y z or, alternatively: fun y = runFun . someFun someDefault y The second option approaches the ideal pointfreeness (or pointlessness if you prefer), but I'd like to go farther: (...) ::

Re: [Haskell-cafe] Pointfree composition for higher arity

2010-02-17 Thread Neil Brown
Sean Leather wrote: I find myself often writing this pattern: someFun x y z = ... fun y z = runFun $ someFun someDefault y z or, alternatively: fun y = runFun . someFun someDefault y I very often write this too (wanting function composition, but with a two-argument

Re: [Haskell-cafe] Pointfree composition for higher arity

2010-02-17 Thread Mike Dillon
That signature is the `oo` specs combinator in Data.Aviary: fun = runFun `oo` someFun someDefault -md begin Sean Leather quotation: I find myself often writing this pattern: someFun x y z = ... fun y z = runFun $ someFun someDefault y z or, alternatively: fun y = runFun .

Re: [Haskell-cafe] Pointfree composition for higher arity

2010-02-17 Thread Stephen Tetley
On 17 February 2010 15:41, Mike Dillon m...@embody.org wrote: That signature is the `oo` specs combinator in Data.Aviary: Hi Mike Thanks - indeed, I was just looking up the thread that covered them a month or two ago: http://www.haskell.org/pipermail/haskell-cafe/2009-December/071392.html I

Re: [Haskell-cafe] Pointfree composition for higher arity

2010-02-17 Thread Daniel Fischer
Am Mittwoch 17 Februar 2010 16:31:16 schrieb Sean Leather: I find myself often writing this pattern: someFun x y z = ... fun y z = runFun $ someFun someDefault y z or, alternatively: fun y = runFun . someFun someDefault y The second option approaches the ideal pointfreeness (or

Re: [Haskell-cafe] Pointfree composition for higher arity

2010-02-17 Thread Mike Dillon
begin Stephen Tetley quotation: On 17 February 2010 15:41, Mike Dillon m...@embody.org wrote: That signature is the `oo` specs combinator in Data.Aviary: Hi Mike Thanks - indeed, I was just looking up the thread that covered them a month or two ago:

Re: [Haskell-cafe] Pointfree composition for higher arity

2010-02-17 Thread Stephen Tetley
On 17 February 2010 16:05, Mike Dillon m...@embody.org wrote: ... Are you kidding me? I love writing code like this:    o = bunting bunting cardinal thrush blackbird :) Hi Mike Thanks! - it took me a surprising amount of time to get from this (where I cheated and used an online

Re: [Haskell-cafe] Pointfree composition for higher arity

2010-02-17 Thread Sean Leather
On Wed, Feb 17, 2010 at 16:48, Stephen Tetley wrote: On 17 February 2010 15:41, Mike Dillon m...@embody.org wrote: That signature is the `oo` specs combinator in Data.Aviary: Nice! I wouldn't recommend writing code that depends on Data.Aviary, but some of the combinators are often worth

Re: [Haskell-cafe] Pointfree composition for higher arity

2010-02-17 Thread Stephen Tetley
Hi Sean Thanks for the comment. David Menendez pointed out on the other thread that they generalize nicely to functors: http://www.haskell.org/pipermail/haskell-cafe/2009-December/071428.html Typographically they are a pun on ML's composition operator (o), if you don't define o - (aka 'monocle'