Re: [Haskell-cafe] Function application like a Unix pipe

2005-11-23 Thread Udo Stenzel
Scherrer, Chad wrote: Maybe my point wasn't clear. Of course this idea of comparing lazy evaluation to Unix pipes is very old (long before July 2004, I'm sure). The point I'm making is that there is an old idea that may be underused. It is, and only because (.) is defined all wrong! The unix

Re: [Haskell-cafe] Function application like a Unix pipe

2005-11-23 Thread Tomasz Zielonka
On Wed, Nov 23, 2005 at 11:17:25AM +0100, Udo Stenzel wrote: infixl 2 \| (\|) = flip (.) -- though I'm using () The unix pipe becomes (filter (foo `isPrefixOf`) \| sort \| nub) or something, which is rather neat, and (#) is used to call member functions, as in Why not use Control.Arrow. ?

Re: [Haskell-cafe] Function application like a Unix pipe

2005-11-23 Thread Henning Thielemann
On Wed, 23 Nov 2005, Udo Stenzel wrote: Scherrer, Chad wrote: Maybe my point wasn't clear. Of course this idea of comparing lazy evaluation to Unix pipes is very old (long before July 2004, I'm sure). The point I'm making is that there is an old idea that may be underused. It is, and only

RE: [Haskell-cafe] Function application like a Unix pipe

2005-11-23 Thread Scherrer, Chad
Henning Thielemann [EMAIL PROTECTED] writes: Since (a . b) x a $ b x a (b x) are equivalent, do you also want to reverse function and argument in order to match argument order of . and $ ? That is x (b . a) x b $ a (x b) a ? I'm sorry, I'm not sure I understand your

RE: [Haskell-cafe] Function application like a Unix pipe

2005-11-23 Thread Henning Thielemann
On Wed, 23 Nov 2005, Scherrer, Chad wrote: Henning Thielemann [EMAIL PROTECTED] writes: Since (a . b) x a $ b x a (b x) are equivalent, do you also want to reverse function and argument in order to match argument order of . and $ ? That is x (b . a) x b $ a (x b) a ? I'm

RE: [Haskell-cafe] Function application like a Unix pipe

2005-11-23 Thread Scherrer, Chad
Henning Thielemann [EMAIL PROTECTED] writes: I want to say, that the order of symbols for ($), (.) and function application is consistent. This is a fine thing. I think that shall not be distroyed by giving ($) and (.) reversed argument order. I see. I like the argument order also,

RE: [Haskell-cafe] Function application like a Unix pipe

2005-11-23 Thread Scherrer, Chad
Udo Stenzel [EMAIL PROTECTED] writes: The unix pipe is actually function composition. Its argument (standard input) isn't explicitly mentioned Then it seems Unix must overload the | operator. I typically use it to do things like grep . *.hs | wc So I think of the types as being grep .

Re: [Haskell-cafe] Function application like a Unix pipe

2005-11-23 Thread Tomasz Zielonka
On Wed, Nov 23, 2005 at 09:01:07AM -0800, Scherrer, Chad wrote: So I think of the types as being grep . *.hs :: String wc :: String - Int -- ok, not really, but it shows the point better. Every unix program has a standard input, even if it doesn't use it, so I would rather give this type to

RE: [Haskell-cafe] Function application like a Unix pipe

2005-11-23 Thread Bill Wood
On Wed, 2005-11-23 at 08:55 -0800, Scherrer, Chad wrote: . . . I see. I like the argument order also, since it so nicely reflects mathematical notation. But I do think there's a place for (flip ($)) and (flip (.)). The problem is that the assignment of fixities is much more subtle and

RE: [Haskell-cafe] Function application like a Unix pipe

2005-11-23 Thread Bill Wood
On Wed, 2005-11-23 at 17:47 +0100, Henning Thielemann wrote: . . . Why is there no () and why is (=) not the default? The order of 'do {a;b;c}' is compatible with that of (). So we have the fundamental conflict, that usually function application is from right to left, but interpreting

Re: [Haskell-cafe] Function application like a Unix pipe

2005-11-23 Thread Cale Gibbard
On 23/11/05, Scherrer, Chad [EMAIL PROTECTED] wrote: Bill Wood [EMAIL PROTECTED] writes: Interesting note: in Richard Bird and Oege de Moor, _Algebra of Programming_, pp. 2-3, the authors write As a departure from tradition, we write f : A - B rather than f : B - A to indicate

Re: [Haskell-cafe] Function application like a Unix pipe

2005-11-23 Thread Bill Wood
On Wed, 2005-11-23 at 21:21 -0500, Cale Gibbard wrote: . . . Hmm, which edition? My copy (5th ed.) uses the ordinary notation: f(x). x f does perhaps make more sense, especially with the current categorical view of functions, but there would have to be a really hugely good reason to

Re: [Haskell-cafe] Function application like a Unix pipe

2005-11-23 Thread jerzy . karczmarczuk
Cale Gibbard: x f does perhaps make more sense, especially with the current categorical view of functions, but there would have to be a really hugely good reason to change notation, as almost all current work puts things the other way around. Almost all? Well, excluding the Smalltalkers,

Re: [Haskell-cafe] Function application like a Unix pipe

2005-11-23 Thread Cale Gibbard
On 24/11/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Cale Gibbard: x f does perhaps make more sense, especially with the current categorical view of functions, but there would have to be a really hugely good reason to change notation, as almost all current work puts things the other

Re: [Haskell-cafe] Function application like a Unix pipe

2005-11-22 Thread Scherrer, Chad
Albert Lai [EMAIL PROTECTED] writes: I offer a simpler, more direct, and pre-existing correspondence between a functional programming construct and unix pipes: Maybe my point wasn't clear. Of course this idea of comparing lazy evaluation to Unix pipes is very old (long before July 2004, I'm

Re: [Haskell-cafe] Function application like a Unix pipe

2005-11-22 Thread Tomasz Zielonka
On Tue, Nov 22, 2005 at 02:09:40PM -0800, Scherrer, Chad wrote: (\|) = flip ($) -- (#) seems to me too pretty for other purposes to use it here. infixl 0 \| -- Again, why can't this be negative or Fractional?? I have a ? operator that does the same thing. Next time I use it I'll check if

Re: [Haskell-cafe] Function application like a Unix pipe

2005-11-21 Thread Albert Lai
I offer a simpler, more direct, and pre-existing correspondence between a functional programming construct and unix pipes: http://www.vex.net/~trebla/weblog/pointfree.html Scherrer, Chad [EMAIL PROTECTED] writes: I'm still trying to settle on a feel for good programming style in Haskell.

[Haskell-cafe] Function application like a Unix pipe

2005-11-18 Thread Scherrer, Chad
I'm still trying to settle on a feel for good programming style in Haskell. One thing I've been making some use of lately is (\|) = flip ($) infixl 0 \| Then expressions like f4 $ f3 $ f2 $ f1 $ x become x \| f1 \| f2 \| f3 \| f4 I've seen something like this on haWiki using (#), but I