[Haskell-cafe] RE: [Haskell] lazy constructors

2004-10-13 Thread Simon Peyton-Jones
[I think this thread would be more appropriate on haskell-café, so I'm redirecting it] | addToSPair :: Char - (String, String) - (String, String) | addToSPairc (xs, ys) = (c:xs, ys) | | --- | | g1 is similar to

Re: [Haskell-cafe] RE: [Haskell] lazy constructors

2004-10-13 Thread MR K P SCHUPKE
addToSPairc ~(xs, ys) =3D (c:xs, ys) I thought pattern bindings had an implicit ~? Keean. ___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] OO idioms redux

2004-10-13 Thread Graham Klyne
Haskell type classes don't really behave as one might expect coming from an OO perspective; cf. http://www.ninebynine.org/Software/Learning-Haskell-Notes.html#type-class-misuse That commentary doesn't say anything about interface inheritance. I don't offhand have a good answer for that

[Haskell-cafe] Re: [Haskell] lazy constructors

2004-10-13 Thread Serge D. Mechveliani
On Wed, Oct 13, 2004 at 09:23:43AM +0100, MR K P SCHUPKE wrote: You can only return a list of pair's lazily, not a pair of lists. If the two strings are independant, then generate each in a separate function, and pair off the results lazily. No, I have several labeled fields in a record,

Re: [Haskell-cafe] Re: [Haskell] lazy constructors

2004-10-13 Thread MR K P SCHUPKE
addToSPair :: Char - (String, String) - (String, String) What about: addToSPair :: Char - String - String - (String,String) so that the pattern match is: addToSPair c xs ys = (c:xs,ys) This is irrefutable? Keean. ___ Haskell-Cafe mailing

Re: [Haskell-cafe] OO idioms redux

2004-10-13 Thread Duncan Coutts
In message [EMAIL PROTECTED] John Goerzen [EMAIL PROTECTED] writes: OK, recently I posed a question about rethinking some OO idioms, and that spawned some useful discussion. I now have a followup question. One of the best features of OO programming is that of inheritance. It can be used

Re: [Haskell-cafe] Re: [Haskell] lazy constructors

2004-10-13 Thread Ben Rudiak-Gould
Serge D. Mechveliani wrote: As the types are resolved before the computation, as the above program shows, how can addToSPair expect anything besides a string pair? Why tilda is not a default? Haskell pairs are lifted, meaning that they also include an extra value (bottom) which doesn't match

Re: [Haskell-cafe] OO idioms redux

2004-10-13 Thread Ben . Yu
The only problem with this is name. It is too easy to have naming clash in haskell. Field selectors are also top-level functions and they shared the same namespace with other functions. for any reasonable scale program, we'll end up with ModuleA.read x, ModuleB.read b. (Yes, we can alias the

[Haskell-cafe] RE: [Haskell] is $ a no-op?

2004-10-13 Thread Graham Klyne
[Switched to haskell-cafe] At 13:24 13/10/04 -0400, Jacques Carette wrote: -- It's kind of like an converse map. I have attempted, unsuccessfully, to write flist above in a point-free manner. Is it possible? Of course it is, but why? flist = flip (map . flip ($)) Some functions are

Re: [Haskell-cafe] Re: OCaml list sees abysmal Language Shootoutresults

2004-10-13 Thread Shawn Garbett
--- Robert Dockins [EMAIL PROTECTED] wrote: Then perhaps it is worth considering having multiple implementations and choosing between them with pragmas and/or command line switches (with a sensible default naturally). Maybe doubly linked lists are not a great idea, but if we had a

Re: [Haskell-cafe] Re: OCaml list sees abysmal Language Shootoutresults

2004-10-13 Thread Philippa Cowderoy
On Wed, 13 Oct 2004, Shawn Garbett wrote: Lists are an integral part of the Haskell language, and in fact most languages have some version of list at a fundamental level. Here's an interesting (not necessarily useful!) shift of viewpoint: What if List were a type class? Then we'd need

[Haskell-cafe] Haskell's overlooked object system: was OO idioms redux

2004-10-13 Thread Ralf Laemmel
John Goerzen wrote: One of the best features of OO programming is that of inheritance. ... Oleg, Keean and me have lying around a draft that adds to this discussion. We reconstruct OCaml's tutorial in Haskell The short paper version is online and under consideration for FOOL:

Re: [Haskell-cafe] Re: OCaml list sees abysmal Language Shootoutresults

2004-10-13 Thread Ketil Malde
Shawn Garbett [EMAIL PROTECTED] writes: viewpoint: What if List were a type class? Or, what if String were one? Could we have painless read/show with arrays of Char, as well as lists, for instance? -kzm -- If I haven't seen further, it is by standing in the footprints of giants

Re: [Haskell-cafe] Haskell's overlooked object system: was OO idioms redux

2004-10-13 Thread Ben . Yu
Some people say that ocaml's object system is kinda useless. The best support I hear so far was:it does not hurt implementation inheritance, the strange # syntax, virtual method, why do I need them? In Java, people are doing programming-against-interface, implementation injection etc. All these

Re: [Haskell-cafe] Haskell's overlooked object system: was OO idioms redux

2004-10-13 Thread Ralf Laemmel
[EMAIL PROTECTED] wrote: Some people say that ocaml's object system is kinda useless. The best support I hear so far was:it does not hurt Why do you (or do these people) think having all the OO idioms of OCaml (see OCamls OO tutorial) is useless? Or do you mean too baroque? If not, what's

Re: [Haskell-cafe] Re: OCaml list sees abysmal Language Shootoutresults

2004-10-13 Thread J. Garrett Morris
--- Ketil Malde wrote: Or, what if String were one? Could we have painless read/show with arrays of Char, as well as lists, for instance? --- end of quote --- I think with a decent set of type classes for collections, better handling of strings would come for free. If any list function could

Re: [Haskell-cafe] Haskell's overlooked object system: was OO idioms redux

2004-10-13 Thread Ben . Yu
Why do you (or do these people) think having all the OO idioms of OCaml (see OCamls OO tutorial) is useless? Or do you mean too baroque? If not, what's missing? Because it does not give us much that we cannot do nicely with the current functional part. separate name space of course. But it

Re: [Haskell-cafe] Re: [Haskell] lazy constructors

2004-10-13 Thread Serge D. Mechveliani
I thank Jeremy Gibbons, Ben Rudiak-Gould, and other people, for their helpful explanations. On Wed, Oct 13, 2004 at 02:34:55PM +0100, Ben Rudiak-Gould wrote: Serge D. Mechveliani wrote: As the types are resolved before the computation, as the above program shows, how can addToSPair