Re: [Haskell-cafe] Re: What I wish someone had told me...

2008-10-17 Thread Paul Johnson
Derek Elkins wrote: All you need is a T-shirt: http://www.cafepress.com/skicalc Or http://www.cafepress.com/l_revolution Paul. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: What I wish someone had told

2008-10-17 Thread John Lato
Richard O'Keefe wrote: On 17 Oct 2008, at 9:53 am, Daryoush Mehrtash wrote: So does this mean that the reason for complexity of generics is the Java inheritance? No. The reason for the complexity of generics in Java is that they weren't designed into the language in the first place. It

Re: [Haskell-cafe] Re: What I wish someone had told me...

2008-10-16 Thread Daryoush Mehrtash
The best analogy I have found on Monads (written for Scala) is the one that compared them to Elephants. The author was referring the the blind men and elephant story: http://en.wikipedia.org/wiki/Blind_Men_and_an_Elephant On Wed, Oct 15, 2008 at 6:40 PM, Derek Elkins [EMAIL PROTECTED]wrote:

Re: Re[2]: [Haskell-cafe] Re: What I wish someone had told me...

2008-10-16 Thread Jonathan Cast
On Thu, 2008-10-16 at 15:02 +1300, Richard O'Keefe wrote: On 16 Oct 2008, at 12:09 pm, Jonathan Cast wrote: I am not sure how say in a Java language a constructor can conjure up a value of an unknown type. Well, that's the point. It can't, in Haskell or in Java. If you understand

Re: Re[2]: [Haskell-cafe] Re: What I wish someone had told me...

2008-10-16 Thread Robert Greayer
On Thu, 2008-10-16 at 15:02 +1300, Richard O'Keefe wrote: On 16 Oct 2008, at 12:09 pm, Jonathan Cast wrote: I am not sure how say in a Java language a constructor can conjure up a value of an unknown type. Well, that's the point. It can't, in Haskell or in Java. If you

Re: Re[2]: [Haskell-cafe] Re: What I wish someone had told me...

2008-10-16 Thread Jonathan Cast
On Thu, 2008-10-16 at 09:48 -0700, Robert Greayer wrote: On Thu, 2008-10-16 at 15:02 +1300, Richard O'Keefe wrote: On 16 Oct 2008, at 12:09 pm, Jonathan Cast wrote: I am not sure how say in a Java language a constructor can conjure up a value of an unknown type.

Re: Re[2]: [Haskell-cafe] Re: What I wish someone had told me...

2008-10-16 Thread Robert Greayer
--- On Thu, 10/16/08, Jonathan Cast [EMAIL PROTECTED] wrote: Can I have HashSetInteger? Could I construct HashSet?, if I did? Yes: HashSet? blah = (HashSet?) hashSetClass.newInstance(); ... compiles, and won't throw an exception if hashSetClass truly is the class object for HashSet.

Re: Re[2]: [Haskell-cafe] Re: What I wish someone had told me...

2008-10-16 Thread Jonathan Cast
On Thu, 2008-10-16 at 10:02 -0700, Robert Greayer wrote: --- On Thu, 10/16/08, Jonathan Cast [EMAIL PROTECTED] wrote: Can I have HashSetInteger? Could I construct HashSet?, if I did? Yes: HashSet? blah = (HashSet?) hashSetClass.newInstance(); ... compiles, and won't throw an

Re: Re[2]: [Haskell-cafe] Re: What I wish someone had told me...

2008-10-16 Thread Robert Greayer
--- On Thu, 10/16/08, Jonathan Cast [EMAIL PROTECTED] wrote: But I can't say new HashSet?()? No... but you can say 'new HashSetT()' where T is a type variable, and then put a value of type T into your set, which is probably generally what you want. HashSet? is a set of unknown (at

Re: Re[2]: [Haskell-cafe] Re: What I wish someone had told me...

2008-10-16 Thread Jonathan Cast
On Thu, 2008-10-16 at 11:41 -0700, Robert Greayer wrote: --- On Thu, 10/16/08, Jonathan Cast [EMAIL PROTECTED] wrote: But I can't say new HashSet?()? No... but you can say 'new HashSetT()' where T is a type variable, and then put a value of type T into your set, which is probably

Re: Re[2]: [Haskell-cafe] Re: What I wish someone had told me...

2008-10-16 Thread Robert Greayer
--- On Thu, 10/16/08, Jonathan Cast [EMAIL PROTECTED] wrote: So if I say void wrong(List? foo, List? bar) I get two /different/ type variables implicitly filled in? If I declare a generic class, and then have a method, is there a way, in that method's parameter list, to say `the type

Re: Re[2]: [Haskell-cafe] Re: What I wish someone had told me...

2008-10-16 Thread Jonathan Cast
On Thu, 2008-10-16 at 12:27 -0700, Robert Greayer wrote: --- On Thu, 10/16/08, Jonathan Cast [EMAIL PROTECTED] wrote: So if I say void wrong(List? foo, List? bar) I get two /different/ type variables implicitly filled in? If I declare a generic class, and then have a method, is

Re: Re[2]: [Haskell-cafe] Re: What I wish someone had told me...

2008-10-16 Thread Daryoush Mehrtash
So does this mean that the reason for complexity of generics is the Java inheritance? BTW, in addition to the article I posted, This site: http://www.angelikalanger.com/GenericsFAQ/JavaGenericsFAQ.html has a FAQ on Java generics that is 500+ pages long! In Haskell you have parametrized

Re: Re[2]: [Haskell-cafe] Re: What I wish someone had told me...

2008-10-16 Thread Derek Elkins
On Thu, 2008-10-16 at 13:53 -0700, Daryoush Mehrtash wrote: So does this mean that the reason for complexity of generics is the Java inheritance? BTW, in addition to the article I posted, This site: http://www.angelikalanger.com/GenericsFAQ/JavaGenericsFAQ.html has a FAQ on Java generics

Re: Re[2]: [Haskell-cafe] Re: What I wish someone had told me...

2008-10-16 Thread Don Stewart
derek.a.elkins: On Thu, 2008-10-16 at 13:53 -0700, Daryoush Mehrtash wrote: So does this mean that the reason for complexity of generics is the Java inheritance? BTW, in addition to the article I posted, This site: http://www.angelikalanger.com/GenericsFAQ/JavaGenericsFAQ.html has a

Re: Re[2]: [Haskell-cafe] Re: What I wish someone had told me...

2008-10-16 Thread Jonathan Cast
On Thu, 2008-10-16 at 16:25 -0500, Derek Elkins wrote: On Thu, 2008-10-16 at 13:53 -0700, Daryoush Mehrtash wrote: So does this mean that the reason for complexity of generics is the Java inheritance? BTW, in addition to the article I posted, This site:

Re: Re[2]: [Haskell-cafe] Re: What I wish someone had told me...

2008-10-16 Thread Richard O'Keefe
On 17 Oct 2008, at 9:53 am, Daryoush Mehrtash wrote: So does this mean that the reason for complexity of generics is the Java inheritance? No. The reason for the complexity of generics in Java is that they weren't designed into the language in the first place. It took several attempts and

[Haskell-cafe] Re: What I wish someone had told me...

2008-10-15 Thread apfelmus
Janis Voigtlaender wrote: Derek Elkins wrote: Agreed. I'm extremely tired of the I haven't heard this term therefore it must be 'scary' and complicated and beyond me attitude. Such people need to stop acting like five year old children. Not that it has much to do with the debate, but the

[Haskell-cafe] Re: What I wish someone had told me...

2008-10-15 Thread John Lato
I'd like to thank everyone who replied to my OP, and also perhaps clarify one point. I wasn't trying to be argumentative or negative about any work people have done to make Haskell approachable for OO programmers (or any other programmers, for that matter). I simply wanted to know what others

Re: [Haskell-cafe] Re: What I wish someone had told me...

2008-10-15 Thread David Leimbach
On Wed, Oct 15, 2008 at 8:08 AM, John Lato [EMAIL PROTECTED] wrote: I'd like to thank everyone who replied to my OP, and also perhaps clarify one point. I wasn't trying to be argumentative or negative about any work people have done to make Haskell approachable for OO programmers (or any

Re: [Haskell-cafe] Re: What I wish someone had told me...

2008-10-15 Thread Lennart Augustsson
The (=) operation for the state monad can be implemented with no understanding at all. Just watch djinn make the code for it. And djinn doesn't understand the state monad, I promise. :) -- Lennart 2008/10/15 David Leimbach [EMAIL PROTECTED]: On Wed, Oct 15, 2008 at 8:08 AM, John Lato

Re[2]: [Haskell-cafe] Re: What I wish someone had told me...

2008-10-15 Thread Bulat Ziganshin
Hello David, Wednesday, October 15, 2008, 7:16:09 PM, you wrote: I've read a lot of the Monad tutorials, and I feel like I only get most of it to be 100% honest.  The State Monad still boggles my mind a little bit.  I understand what it's supposed to do and I get the idea about how it works.

RE: [Haskell-cafe] Re: What I wish someone had told me...

2008-10-15 Thread Mitchell, Neil
PROTECTED] On Behalf Of David Leimbach Sent: 15 October 2008 4:16 pm To: John Lato Cc: haskell-cafe@haskell.org Subject: Re: [Haskell-cafe] Re: What I wish someone had told me... On Wed, Oct 15, 2008 at 8:08 AM, John Lato [EMAIL PROTECTED] wrote

[Haskell-cafe] Re: What I wish someone had told me...

2008-10-15 Thread John Lato
Albet Lai wrote: John Lato wrote: Are you advocating introducing existential types to beginning Haskellers? I think something with the scary name existential quantification would greatly increase the head'splodin' on the learnin' slope. OOP(*) advocates introducing existential types to

[Haskell-cafe] Re: What I wish someone had told me...

2008-10-15 Thread Stefan Monnier
The instance selection for an interface is done at run-time and this is inherently necessary. The instance (in a different sense) selection for type classes is almost always resolvable statically. In Haskell 98 In both cases, the dispatch is inherently dynamic, and in both cases, most

[Haskell-cafe] Re: What I wish someone had told me...

2008-10-15 Thread Stefan Monnier
leaders and pioneers: if you know one language, picking up others should be easy, they just differ in syntax. I have heard it, and I used to believe it. Now I think it's only true provided the one language you know is suitably advanced (and currently non-existent, I think). It all depends

Re: [Haskell-cafe] Re: What I wish someone had told me...

2008-10-15 Thread Daryoush Mehrtash
The equivalent won't compile in Haskell, because the actual return type does matter, and *is determined by the calling code*. Our fictional GetListOfData can't return a List or a Mylist depending on some conditional, in fact it can't explicitly return either one at all, because the actual

Re: [Haskell-cafe] Re: What I wish someone had told me...

2008-10-15 Thread Jonathan Cast
On Wed, 2008-10-15 at 11:56 -0700, Daryoush Mehrtash wrote: The equivalent won't compile in Haskell, because the actual return type does matter, and *is determined by the calling code*. Our fictional GetListOfData can't return a List or a Mylist

Re: [Haskell-cafe] Re: What I wish someone had told me...

2008-10-15 Thread Daryoush Mehrtash
Would you please explain this a bit more: the various unfortunate consequences of type erasure in Java are avoided by the fact that Haskell types lack constructors, so the user never expects to be able to conjure up a value of an unknown type. Thanks, daryoush On Wed, Oct 15, 2008 at 12:04

Re[2]: [Haskell-cafe] Re: What I wish someone had told me...

2008-10-15 Thread Bulat Ziganshin
Hello Daryoush, Wednesday, October 15, 2008, 10:56:39 PM, you wrote: If you notice  java generics has all sort of gotchas (e.g. http://www.ibm.com/developerworks/java/library/j-jtp01255.html).  I large prob;em of OOP languages with generics is interaction between those two types of

Re: Re[2]: [Haskell-cafe] Re: What I wish someone had told me...

2008-10-15 Thread Daryoush Mehrtash
I am having hard time understanding this statement: Haskell types lack constructors, so the user never expects to be able to conjure up a value of an unknown type. I am not sure how say in a Java language a constructor can conjure up a value of an unknown type. daryoush On Wed, Oct 15, 2008

Re: [Haskell-cafe] Re: What I wish someone had told me...

2008-10-15 Thread wren ng thornton
Daryoush Mehrtash wrote: I have had an unresolved issue on my stack of Haskell vs Java that I wonder if your observation explains. If you notice java generics has all sort of gotchas (e.g. http://www.ibm.com/developerworks/java/library/j-jtp01255.html). I somehow don't see this discussion in

Re: Re[2]: [Haskell-cafe] Re: What I wish someone had told me...

2008-10-15 Thread Jonathan Cast
On Wed, 2008-10-15 at 13:01 -0700, Daryoush Mehrtash wrote: I am having hard time understanding this statement: Haskell types lack constructors, so the user never expects to be able to conjure up a value of an unknown type. I am not sure how say in a Java language

Re: [Haskell-cafe] Re: What I wish someone had told me...

2008-10-15 Thread Derek Elkins
On Wed, 2008-10-15 at 14:45 -0400, Stefan Monnier wrote: The instance selection for an interface is done at run-time and this is inherently necessary. The instance (in a different sense) selection for type classes is almost always resolvable statically. In Haskell 98 In both cases, the

Re: [Haskell-cafe] Re: What I wish someone had told me...

2008-10-15 Thread Derek Elkins
On Wed, 2008-10-15 at 08:16 -0700, David Leimbach wrote: On Wed, Oct 15, 2008 at 8:08 AM, John Lato [EMAIL PROTECTED] wrote: I'd like to thank everyone who replied to my OP, and also perhaps clarify one point. I wasn't trying to be argumentative or negative

Re: Re[2]: [Haskell-cafe] Re: What I wish someone had told me...

2008-10-15 Thread Richard O'Keefe
On 16 Oct 2008, at 9:01 am, Daryoush Mehrtash wrote: I am not sure how say in a Java language a constructor can conjure up a value of an unknown type. ... Class anUnknownClass; Object anInstance; anInstance = anUnknownClass.getConstructor().newInstance(); If you know that the

Re: Re[2]: [Haskell-cafe] Re: What I wish someone had told me...

2008-10-15 Thread Richard O'Keefe
On 16 Oct 2008, at 12:09 pm, Jonathan Cast wrote: I am not sure how say in a Java language a constructor can conjure up a value of an unknown type. Well, that's the point. It can't, in Haskell or in Java. If you understand that --- that you can't call the default constructor of a class

Re: [Haskell-cafe] Re: What I wish someone had told me...

2008-10-15 Thread Stefan Monnier
Would you please explain this a bit more: the various unfortunate consequences of type erasure in Java are avoided by the fact that Haskell types lack constructors, so the user never expects to be able to conjure up a value of an unknown type. Even if Haskell had Java-style constructors, it

[Haskell-cafe] Re: What I wish someone had told me...

2008-10-14 Thread John Lato
While this may be true, it's missing the point. The claim that type classes are like interfaces (the usual argument is that they define an interface, but not an implementation) misleads OO-grounded programmers into thinking of type classes in terms of an already-familiar concept. This is bad