(note to Haskellers: Yeah, I'm handwaving things here, no need to point out counter-examples to my generalisations!)
On 4/26/07, phi...@free.fr <phi...@free.fr> wrote: We'll do this one first:
What are the mysterious "side effects" which are avoided by using Haskell, which everyone talks about? Null pointers?
Side effects are usually things like mutable state. In Haskell variables don't vary. "x=x+1" isn't valid in Haskell. This means, among other things, that functions always do the same thing given the same input (they can't depend on some mutable state changing value), which is great since you'll never get those "oh I forgot that I must first call foo before I call bar, or I'll get an error". This really is a HUGE win, since programming with state is unreasonably error-prone. I'm afraid it's next to impossible to convince anyone that this is true, unless they're willing to give it a serious try, though :-)
Null pointers are possible when you're dealing with C functions mostly. You don't use pointers in Haskell normally, only when you're interfacing with external C libraries etc.
Hello,
> what are the advantages of haskell over semi-functional programming > languages > such as Perl, Common Lisp, etc.?
For me? Purity. I mean you can get plenty of the benefits of FP in any old language (witness C# 3.0), but the one thing you can never get by just adding support for a "functional style" in another language is purity. Once purity is gone, it's gone! It can't be retrofitted on an existing language.
Purity is great because it makes it much easier to write programs without making silly mistakes. When writing programs in languages with lots of side effects you have to sort of keep a "mental log" in your head for all possible execution paths ("in this branch x is equal to y plus w, and this pointer here is null in the other branch x is null and..."). For me I can quite literally *feel* "brain resources" being freed up when using Haskell, which I can use to get stuff done quicker (or probably more accurate: I can feel how much brainpower I waste on book keeping and keeping track of this "mental log" when using languages like C++).
Also purity is very interesting when you want to paralellize programs (a pure function can be executed on any thread, at any time, and its guaranteed to never interfer with the computation of other functions -- in impure languages this doesn't hold at all!). This is probably the killer app for functional programming IMO. FP is cool for a number of reasons, but I think "isn't almost unusable in a multithreaded setting" is what sets it apart the most from imperative languages.
Haskell also has STM which is great for that low level shared state concurrency that you sometimes need (no locks, monitors, or any of that non-composable, insanity-inducing, messiness!)
> Aren't Haskell's advantages outweighed by its complexity (Monads, etc.) > and > rigidity?
I can sometimes feel that Haskell looses out on not being user friendly in the Java sense (i.e. "cut out any feature that can't be understood in five minutes by a chimp"). Some things do take some effort to learn, but there is a huge payoff for it (it's really powerful!). But yeah, there might be plenty of folks who will never bother learning about them, and they won't understand your code.
-- Sebastian Sylvan +44(0)7857-300802 UIN: 44640862
There are plenty of advantages to Haskell; but it doesn't mean that it's the only language I use now. I read an article about Perl vs. Python once, and the point that stuck with me most was "The Perl motto is TMTOWTDI, and Python's just another WTDI." The same applies to Haskell, or any other language for that matter. I love Haskell; my code is usually bug-free (or close) the first time I run it because of its features like having no side effects. But I still use Perl for system administration, and I'm developing a window manager in Scheme now because of its features.
As far as Haskell's disadvantages, I don't see monads as a disadvantage; most descriptions of them are complicated, but there are plenty of good tutorials out there. Rigidity is a double edged sword; it helps keep your code working, but it does make you jump through some hoops to get certain things working.
I'm new to these ideas too--especially since my college math training is non-existent. I found the following wikipedia articles particularly illuminating on the topic of side-effects:
FP is a completely different way of thinking about solving a problem than is generally used in imperative programming. It's a lot more like math (see Alonso Church, Lambda Calculus, and Haskell Curry, after which Haskell is named and the process called "Currying," -> another great wikipedia read: http://en.wikipedia.org/wiki/Currying where some of the real power of FP comes from).
The main advantage to solving the problems in this way is that you can be more sure (like mathematical proof kind of sure) that your program does what it's intended to do.
As far as language vs language discussion, I say get a book, or look on the net for a tutorial (try haskell.org for starters) and try it out and see if it works for you. That's what I'm doing. It's fun! But, use the right tool for the job, of course, as Rob pointed out.
Cheers, Mike (FP Ultra-Noob)
On 4/26/07, Sebastian Sylvan <sebastian.syl...@gmail.com> wrote:
> (note to Haskellers: Yeah, I'm handwaving things here, no need to point out > counter-examples to my generalisations!)
> On 4/26/07, phi...@free.fr <phi...@free.fr> wrote: > We'll do this one first:
> What are the mysterious "side effects" which are avoided by using Haskell, > which > everyone talks about? Null pointers?
> Side effects are usually things like mutable state. In Haskell variables > don't vary. "x=x+1" isn't valid in Haskell. This means, among other things, > that functions always do the same thing given the same input (they can't > depend on some mutable state changing value), which is great since you'll > never get those "oh I forgot that I must first call foo before I call bar, > or I'll get an error". This really is a HUGE win, since programming with > state is unreasonably error-prone. I'm afraid it's next to impossible to > convince anyone that this is true, unless they're willing to give it a > serious try, though :-)
> Null pointers are possible when you're dealing with C functions mostly. You > don't use pointers in Haskell normally, only when you're interfacing with > external C libraries etc.
> > Hello,
> > what are the advantages of haskell over semi-functional programming > languages > > such as Perl, Common Lisp, etc.?
> For me? Purity. I mean you can get plenty of the benefits of FP in any old > language (witness C# 3.0), but the one thing you can never get by just > adding support for a "functional style" in another language is purity. Once > purity is gone, it's gone! It can't be retrofitted on an existing language.
> Purity is great because it makes it much easier to write programs without > making silly mistakes. When writing programs in languages with lots of side > effects you have to sort of keep a "mental log" in your head for all > possible execution paths ("in this branch x is equal to y plus w, and this > pointer here is null in the other branch x is null and..."). For me I can > quite literally *feel* "brain resources" being freed up when using Haskell, > which I can use to get stuff done quicker (or probably more accurate: I can > feel how much brainpower I waste on book keeping and keeping track of this > "mental log" when using languages like C++).
> Also purity is very interesting when you want to paralellize programs (a > pure function can be executed on any thread, at any time, and its guaranteed > to never interfer with the computation of other functions -- in impure > languages this doesn't hold at all!). This is probably the killer app for > functional programming IMO. FP is cool for a number of reasons, but I think > "isn't almost unusable in a multithreaded setting" is what sets it apart the > most from imperative languages.
> Haskell also has STM which is great for that low level shared state > concurrency that you sometimes need (no locks, monitors, or any of that > non-composable, insanity-inducing, messiness!)
> > Aren't Haskell's advantages outweighed by its complexity (Monads, etc.) > and > > rigidity?
> I can sometimes feel that Haskell looses out on not being user friendly in > the Java sense (i.e. "cut out any feature that can't be understood in five > minutes by a chimp"). Some things do take some effort to learn, but there is > a huge payoff for it (it's really powerful!). But yeah, there might be > plenty of folks who will never bother learning about them, and they won't > understand your code.
> -- > Sebastian Sylvan > +44(0)7857-300802 > UIN: 44640862 > _______________________________________________ > Haskell mailing list > Hask...@haskell.org > http://www.haskell.org/mailman/listinfo/haskell
Problem with partially functional languages in my opinion is if you can do things the way that your most use i.e. imperative programming you will do it
Perl, Python, Lisp, Scheme and etc have features that support functional programming but I would wager that you will find more imperative code written in those languages then you would functional code. People tend to do things in the way there most accustom too and most developers are educated in and work in imperative languages so if you really want to do FP then your better to stick to a language that doesn't support other more familiar paradigms otherwise you will find yourself falling back on more comfortable and familiar ways of doing things.
Side effects include I/O, mutable assignment (destructively writing to memory), generating random numbers etc. Haskell of course has to allow these things otherwise it could not produce useful programs it just does a lot better job of isolating these side effects from Code that does not have these side effects which have many benefits first most being the ability to compose/glue code together in all sorts of neat ways and not having to worry about unintentional side effects.
Advantage of Haskell over most other languages would be the core language itself and its ability to glue software components together in a safe way. This advantage doesn't come without some pain and learning curve though.
Haskell is also a great language to learn new ideas and ways of thinking about building software this is my interest in this language at this time.
Haskell is a good place to start if you are looking to write something from scratch Unfortunately this is not my case.
Disadvantages of Haskell are unfortunately greater then its advantages as beautiful a programming language as Haskell is it lacks Libraries ( A great glue language without many components to glue together is a sad irony) and Tooling
Haskell is not a language to get stuff done quickly in. I will probably use Monads in a real world project in VB.NET 9 before Haskell.
I am not a Perl fan but CPAN is very cool when I have had to do something in Perl I could find what I need there and it was well documented too.
Haskell to me is the promise of a dream yet unrealized in which you easily glue together components together and it just works maybe one day these components will actually get written.
On Behalf Of phi...@free.fr Sent: Thursday, April 26, 2007 12:48 PM To: hask...@haskell.org Subject: [Haskell] Newbie: what are the advantages of Haskell?
Hello,
what are the advantages of haskell over semi-functional programming languages such as Perl, Common Lisp, etc.?
What are the mysterious "side effects" which are avoided by using Haskell, which everyone talks about? Null pointers?
Don't you ever get null pointers in Haskell, including when doing IO?
Aren't Haskell's advantages outweighed by its complexity (Monads, etc.) and rigidity?
Last but not least, I would like to learn from those among you who are former PERL developers, why you switched to Haskell.
Sebastian Sylvan wrote: > (note to Haskellers: Yeah, I'm handwaving things here, no need to point out > counter-examples to my generalisations!)
> On 4/26/07, phi...@free.fr <phi...@free.fr> wrote: (snip)
> Null pointers are possible when you're dealing with C functions mostly. You > don't use pointers in Haskell normally, only when you're interfacing with > external C libraries etc.
Having recently moved into Haskell myself, I'd like to elaborate a little regarding null pointers. Actual null pointers are, as Sylvan states, only an issue when interfacing or working at a low level.
I think the other kind of null pointers are more important. If you call a method MyObject getObjectFromStrings(String s1, String st) in java, you may have to check both your strings - they may be null, and subsequent logic may call string methods on them, which would raise an exception. Also, the method may return null, and you may have to handle this with an if-statement. MyObject theObject = getObjectFromStrings(first, second); if (theObject != null) {useObject(myObject);}
In Haskell, you would have a function getObjectFromStrings::String->String->MyObject
This can not be called with any other types than strings - the type system will not allow it. If you need to express the idea of maybe receiving a worthless value, you need to use the type Maybe, like this:
and you would use pattern matching to implement the two possibilities of a Maybe: Nothing and Just value. getObjectFromStrings Nothing Nothing = Nothing getObjectFromStrings (Just firstString) (Just otherString) = (Just ( MyObject { f= firstString.....
For most programming, the obligatory checking of possible null values just disappears.
Keith Fahlgren wrote: > On 4/26/07 10:13 AM, Joe Thornber wrote: >> On 26/04/07, Johannes Waldmann <waldm...@imn.htwk-leipzig.de> wrote: >>> phi...@free.fr wrote:
>>>> [...] semi-functional programming languages such as Perl [...] >>> now this is an interesting view ... >> I seem to remember someone writing a book on functional programming in >> Perl, which seemed odd to me.
> For the record, you're probably thinking of Higher-Order Perl, by Mark Jason > Dominus.
Java sense (i.e. "cut out any feature that can't be understood in five minutes by a chimp")
Got to love comments like this they are constructive, objective, mature and accurate.
Glad we have your expert opinion to give us the gospel.
Can I get an amen? How about a Hallelujah ?
Troy Taillefer Java chimpanzee
________________________________
From: haskell-boun...@haskell.org [mailto:haskell-boun...@haskell.org] On Behalf Of Sebastian Sylvan Sent: Thursday, April 26, 2007 1:27 PM To: phi...@free.fr Cc: hask...@haskell.org Subject: Re: [Haskell] Newbie: what are the advantages of Haskell?
(note to Haskellers: Yeah, I'm handwaving things here, no need to point out counter-examples to my generalisations!)
On 4/26/07, phi...@free.fr <phi...@free.fr> wrote: We'll do this one first:
What are the mysterious "side effects" which are avoided by using Haskell, which everyone talks about? Null pointers?
Side effects are usually things like mutable state. In Haskell variables don't vary. "x=x+1" isn't valid in Haskell. This means, among other things, that functions always do the same thing given the same input (they can't depend on some mutable state changing value), which is great since you'll never get those "oh I forgot that I must first call foo before I call bar, or I'll get an error". This really is a HUGE win, since programming with state is unreasonably error-prone. I'm afraid it's next to impossible to convince anyone that this is true, unless they're willing to give it a serious try, though :-)
Null pointers are possible when you're dealing with C functions mostly. You don't use pointers in Haskell normally, only when you're interfacing with external C libraries etc.
Hello,
what are the advantages of haskell over semi-functional programming languages such as Perl, Common Lisp, etc.?
For me? Purity. I mean you can get plenty of the benefits of FP in any old language (witness C# 3.0), but the one thing you can never get by just adding support for a "functional style" in another language is purity. Once purity is gone, it's gone! It can't be retrofitted on an existing language.
Purity is great because it makes it much easier to write programs without making silly mistakes. When writing programs in languages with lots of side effects you have to sort of keep a "mental log" in your head for all possible execution paths ("in this branch x is equal to y plus w, and this pointer here is null in the other branch x is null and..."). For me I can quite literally *feel* "brain resources" being freed up when using Haskell, which I can use to get stuff done quicker (or probably more accurate: I can feel how much brainpower I waste on book keeping and keeping track of this "mental log" when using languages like C++).
Also purity is very interesting when you want to paralellize programs (a pure function can be executed on any thread, at any time, and its guaranteed to never interfer with the computation of other functions -- in impure languages this doesn't hold at all!). This is probably the killer app for functional programming IMO. FP is cool for a number of reasons, but I think "isn't almost unusable in a multithreaded setting" is what sets it apart the most from imperative languages.
Haskell also has STM which is great for that low level shared state concurrency that you sometimes need (no locks, monitors, or any of that non-composable, insanity-inducing, messiness!)
Aren't Haskell's advantages outweighed by its complexity (Monads, etc.) and rigidity?
I can sometimes feel that Haskell looses out on not being user friendly in the Java sense (i.e. "cut out any feature that can't be understood in five minutes by a chimp"). Some things do take some effort to learn, but there is a huge payoff for it (it's really powerful!). But yeah, there might be plenty of folks who will never bother learning about them, and they won't understand your code.
-- Sebastian Sylvan +44(0)7857-300802 UIN: 44640862
Taillefer, Troy (EXP) wrote: > Java sense (i.e. "cut out any feature that can't be understood in five > minutes by a chimp")
> Got to love comments like this they are constructive, objective, mature > and accurate.
> Glad we have your expert opinion to give us the gospel.
> Can I get an amen? How about a Hallelujah ?
Admittedly, this is phrased in an inflammatory manner, however, the original sentiment is actually pointing out an advantage of Java over Haskell. Here is the original paragraph in context:
Sebastian Sylvan wrote: > I can sometimes feel that Haskell looses out on not being user friendly > in the Java sense (i.e. "cut out any feature that can't be understood in > five minutes by a chimp"). Some things do take some effort to learn, but > there is a huge payoff for it (it's really powerful!). But yeah, there > might be plenty of folks who will never bother learning about them, and > they won't understand your code.
IOW: Java's advanced features are separable from its basic features. I.e. you can teach Java without teaching generics or anonymous inner classes. In Haskell, OTOH, you can't even learn how to do IO without learning Monads, or at least glossing over oddities like a new syntax. And thats not even getting into issues like statelessness and lazy evaluation.
So for a new user, Java is the better language. You can get into its features slowly and as you see the need for them. Haskell requires you to learn a number of mind-bending concepts right up front. Java has a gentle learning curve and Haskell has a vertical jump.
But, Sebastian is right. The leap is worth it. Its the same as what someone once said about LISP: even if you never get to use Haskell regularly, you will be a better programmer when you finally "get it".
Am Freitag, 27. April 2007 18:18 schrieb Al Falloon:
> [ ] > IOW: Java's advanced features are separable from its basic features. > I.e. you can teach Java without teaching generics or anonymous inner > classes. In Haskell, OTOH, you can't even learn how to do IO without > learning Monads, or at least glossing over oddities like a new syntax. > And thats not even getting into issues like statelessness and lazy > evaluation.
As for Java, this is not quite true. In Java, you cannot write a Hello world! program without stumbling over classes and static methods. And if you start using I/O, you will soon have to deal with rather complex class and object structures. (At least this used to be the case.)
> I.e. you can teach Java without teaching generics or anonymous inner classes.
but you shouldn't -
if you can teach the type-correct use of arrays (it's done for decades), then you can teach generic collections (at least their proper usage),
and what's the problem with the anonymous class in x.addActionListener(new ActionListener(){ void actionPerformed(..){..}});
back to the original question (see subject): one advantage that gets easily overlooked is lazy evaluation, leading to better modularization, because you can decouple object (stream) generation from transformation from consumption, and still be space efficient. with eager evaluation this would require jumping through many hoops, destroying the logical structure of the program. and once you're lazy, then it's mandatory to be pure.
>Admittedly, this is phrased in an inflammatory manner, however, the
original sentiment >>is actually pointing out an advantage of Java over Haskell. Here is the original >>>.paragraph in context:
This not the first inflammatory comment he has made
>>But, Sebastian is right.
Sebastian will be right when I see Chimpanzees coding in Java :)
>> The leap is worth it.
I am not so sure it was for me. I guess It depends on what you are looking for I have spent the last year learning Haskell and I have learned some very interesting concepts. I can't help but wish that Haskell turned out to be a more practical language for me to code something useful in every time I looked for Haskell libraries I was a disappointed. I can't help feeling that last year might have been better spent learning Erlang (which is this years language for me to learn).
I really enjoy Functional programming (at least until I try to do something serious then frustration sets in). I can't produce software in a timely and cost effective fashion without a large body of high quality, documented and maintained libraries.
I get the feeling that Haskell is for researchers to explore ideas about programming in but no one is interested in doing The grind work of cranking out useful basic libraries. I guess you need borrow some of those Java Chimps :).
Am I the only person on the list that feels this way ?
I guess I am feeling a bit bitter of spending so much time on Haskell and having so little to show for it.
On Behalf Of Al Falloon Sent: Friday, April 27, 2007 12:19 PM To: hask...@haskell.org Cc: hask...@haskell.org Subject: [Haskell] Re: Newbie: what are the advantages of Haskell?
Taillefer, Troy (EXP) wrote: > Java sense (i.e. "cut out any feature that can't be understood in five
> minutes by a chimp")
> Got to love comments like this they are constructive, objective, > mature and accurate.
> Glad we have your expert opinion to give us the gospel.
> Can I get an amen? How about a Hallelujah ?
Admittedly, this is phrased in an inflammatory manner, however, the original sentiment is actually pointing out an advantage of Java over Haskell. Here is the original paragraph in context:
Sebastian Sylvan wrote: > I can sometimes feel that Haskell looses out on not being user > friendly in the Java sense (i.e. "cut out any feature that can't be > understood in five minutes by a chimp"). Some things do take some > effort to learn, but there is a huge payoff for it (it's really > powerful!). But yeah, there might be plenty of folks who will never > bother learning about them, and they won't understand your code.
IOW: Java's advanced features are separable from its basic features. I.e. you can teach Java without teaching generics or anonymous inner classes. In Haskell, OTOH, you can't even learn how to do IO without learning Monads, or at least glossing over oddities like a new syntax. And thats not even getting into issues like statelessness and lazy evaluation.
So for a new user, Java is the better language. You can get into its features slowly and as you see the need for them. Haskell requires you to learn a number of mind-bending concepts right up front. Java has a gentle learning curve and Haskell has a vertical jump.
But, Sebastian is right. The leap is worth it. Its the same as what someone once said about LISP: even if you never get to use Haskell regularly, you will be a better programmer when you finally "get it".
As a Java chimp embarking on the Haskell journey myself, I'd be interested in hearing about specific ways that learning Haskell has changed the way you program Java. How do you employ the "very interesting concepts" that you have learned through your study of Haskell in your Java programming? Do you employ them at all? _Can_ they be employed in Java? Has it made you a better Java programmer?
Cheers, Mike
On 4/27/07, Taillefer, Troy (EXP) <troy.taille...@lmco.com> wrote:
> >Admittedly, this is phrased in an inflammatory manner, however, the > original sentiment >>is actually pointing out an advantage of Java over > Haskell. Here is the original >>>.paragraph in context:
> This not the first inflammatory comment he has made
> >>But, Sebastian is right. > Sebastian will be right when I see Chimpanzees coding in Java :)
> >> The leap is worth it. > I am not so sure it was for me. > I guess It depends on what you are looking for I have spent the last > year learning Haskell and I have learned some very interesting concepts. > I can't help but wish that Haskell turned out to be a more practical > language for me to code something useful in every time I looked for > Haskell libraries I was a disappointed. > I can't help feeling that last year might have been better > spent learning Erlang (which is this years language for me to learn).
> I really enjoy Functional programming (at least until I try to do > something serious then frustration sets in). I can't produce software in > a timely and cost effective fashion without a large body of high > quality, documented and maintained libraries.
> I get the feeling that Haskell is for researchers to explore ideas about > programming in but no one is interested in doing The grind work of > cranking out useful basic libraries. > I guess you need borrow some of those Java Chimps :).
> Am I the only person on the list that feels this way ?
> I guess I am feeling a bit bitter of spending so much time on Haskell > and having so little to show for it.
> Troy
> -----Original Message----- > From: haskell-boun...@haskell.org [mailto:haskell-boun...@haskell.org] > On Behalf Of Al Falloon > Sent: Friday, April 27, 2007 12:19 PM > To: hask...@haskell.org > Cc: hask...@haskell.org > Subject: [Haskell] Re: Newbie: what are the advantages of Haskell?
> Taillefer, Troy (EXP) wrote: > > Java sense (i.e. "cut out any feature that can't be understood in five
> > minutes by a chimp")
> > Got to love comments like this they are constructive, objective, > > mature and accurate.
> > Glad we have your expert opinion to give us the gospel.
> > Can I get an amen? How about a Hallelujah ?
> Admittedly, this is phrased in an inflammatory manner, however, the > original sentiment is actually pointing out an advantage of Java over > Haskell. Here is the original paragraph in context:
> Sebastian Sylvan wrote: > > I can sometimes feel that Haskell looses out on not being user > > friendly in the Java sense (i.e. "cut out any feature that can't be > > understood in five minutes by a chimp"). Some things do take some > > effort to learn, but there is a huge payoff for it (it's really > > powerful!). But yeah, there might be plenty of folks who will never > > bother learning about them, and they won't understand your code.
> IOW: Java's advanced features are separable from its basic features. > I.e. you can teach Java without teaching generics or anonymous inner > classes. In Haskell, OTOH, you can't even learn how to do IO without > learning Monads, or at least glossing over oddities like a new syntax. > And thats not even getting into issues like statelessness and lazy > evaluation.
> So for a new user, Java is the better language. You can get into its > features slowly and as you see the need for them. Haskell requires you > to learn a number of mind-bending concepts right up front. Java has a > gentle learning curve and Haskell has a vertical jump.
> But, Sebastian is right. The leap is worth it. Its the same as what > someone once said about LISP: even if you never get to use Haskell > regularly, you will be a better programmer when you finally "get it".
> As a Java chimp embarking on the Haskell journey myself, I'd be > interested in hearing about specific ways that learning Haskell has > changed the way you program Java. How do you employ the "very > interesting concepts" that you have learned through your study of > Haskell in your Java programming? Do you employ them at all? _Can_ > they be employed in Java? Has it made you a better Java programmer?
> Cheers, > Mike
I reinvented functional programming when I was using Java rather than Haskell making me use Java more succintly. I knew something was seriously wrong with imperative programming and Java's type system all those years I spent working on the implementation for IBM. I was pleased to learn that Haskell incorporated many of my ideas (and more) - validating my original suspicions. The fact that many of the concepts in Haskell I had already "invented" made the language easy for me to learn (as in, "oh yeah of course that makes perfect sense" in response to discover monads).
I produced many Java projects in an attempt to demonstrate what I thought was wrong, but few of them remain due to loss of interest.
In regard to the original question, 'What are the mysterious "side effects" which are avoided by using Haskell, which everyone talks about? Null pointers?', my response is "yes".
Looking at a NullPointerException (NPE), these exist because of the imperative nature of the code; with explicit order of evaluation and potential side-effects. In an attempt to highlight the absurdity of the fact that a NPE even exists, I like to tell people that "NPEs occur when you write a program that says, 'give me the something that is not there yet'". Now, if you have read Stephen Hawking's Brief History of Time and the chapter titled, Arrow of Time, you will know that "the arrow of time will not reverse". How absurd it is to suggest otherwise by imperative programmers! Simply, a programming language that allows an expression of "give me the non-existent something" contains a logical absurdity.
let p(something) = something exists let q(something) = something is non-existent let r = p ? ¬q let s = p ? q therefore r therefore s but r ? ¬s !!
I have long considered (well before I knew about Haskell) formulating a more concrete proof that imperative programming contains many logical absurdities.
Remember, forall software. software is based on the lambda calculus. I believe that you can prove this.
>> As a Java chimp embarking on the Haskell journey myself, I'd be >> interested in hearing about specific ways that learning Haskell has >> changed the way you program Java. How do you employ the "very >> interesting concepts" that you have learned through your study of >> Haskell in your Java programming? Do you employ them at all? _Can_ >> they be employed in Java? Has it made you a better Java programmer?
>> Cheers, >> Mike
> I reinvented functional programming when I was using Java rather than > Haskell making me use Java more succintly. I knew something was > seriously wrong with imperative programming and Java's type system all > those years I spent working on the implementation for IBM. I was pleased > to learn that Haskell incorporated many of my ideas (and more) - > validating my original suspicions. The fact that many of the concepts in > Haskell I had already "invented" made the language easy for me to learn > (as in, "oh yeah of course that makes perfect sense" in response to > discover monads).
> I produced many Java projects in an attempt to demonstrate what I > thought was wrong, but few of them remain due to loss of interest.
> In regard to the original question, 'What are the mysterious "side > effects" which are avoided by using Haskell, which everyone talks about? > Null pointers?', my response is "yes".
> Looking at a NullPointerException (NPE), these exist because of the > imperative nature of the code; with explicit order of evaluation and > potential side-effects. In an attempt to highlight the absurdity of the > fact that a NPE even exists, I like to tell people that "NPEs occur when > you write a program that says, 'give me the something that is not there > yet'".
[cut]
And then you come to Haskell and you -can- say, "Give me the something that is not there yet."
1. I am much more careful how I combine ( inherit, compose, aggregate ) code because of potential side affects
2. It has helped to find certain types of bugs in Java code more easily that come up because of subtle effects introduced by combining code together
3. It has helped me to write code that is more composable
4. Haskell has increased my awareness of how important type safety is So I use Java Generics more now to enforce more type safety when I can (sometimes I am stuck deploying to java 1.4) (I also use C++ templates to do the same thing for C++) But these are often feel like hacks
Haskell's type system is a thing of pure beauty haven't seen anything quite like it in any other PL (ML and OCAML are as close as I have seen but still fall short) and Generics and Templates really can't compare
You really want the compiler to help you out as much it can. Have it tell you when you are doing something that you shouldn't be doing.
By the way Mike thanks you just totally cheered me up I guess I just needed to sit back and think about what I have learned and how valuable it is to me.
On Behalf Of mike clemow Sent: Friday, April 27, 2007 4:16 PM To: hask...@haskell.org Subject: Re: [Haskell] Re: Newbie: what are the advantages of Haskell?
Troy,
As a Java chimp embarking on the Haskell journey myself, I'd be interested in hearing about specific ways that learning Haskell has changed the way you program Java. How do you employ the "very interesting concepts" that you have learned through your study of Haskell in your Java programming? Do you employ them at all? _Can_ they be employed in Java? Has it made you a better Java programmer?
Cheers, Mike
On 4/27/07, Taillefer, Troy (EXP) <troy.taille...@lmco.com> wrote: > >Admittedly, this is phrased in an inflammatory manner, however, the > original sentiment >>is actually pointing out an advantage of Java > over Haskell. Here is the original >>>.paragraph in context:
> This not the first inflammatory comment he has made
> >>But, Sebastian is right. > Sebastian will be right when I see Chimpanzees coding in Java :)
> >> The leap is worth it. > I am not so sure it was for me. > I guess It depends on what you are looking for I have spent the last > year learning Haskell and I have learned some very interesting concepts. > I can't help but wish that Haskell turned out to be a more practical > language for me to code something useful in every time I looked for > Haskell libraries I was a disappointed. > I can't help feeling that last year might have been better spent > learning Erlang (which is this years language for me to learn).
> I really enjoy Functional programming (at least until I try to do > something serious then frustration sets in). I can't produce software > in a timely and cost effective fashion without a large body of high > quality, documented and maintained libraries.
> I get the feeling that Haskell is for researchers to explore ideas > about programming in but no one is interested in doing The grind work > of cranking out useful basic libraries. > I guess you need borrow some of those Java Chimps :).
> Am I the only person on the list that feels this way ?
> I guess I am feeling a bit bitter of spending so much time on Haskell > and having so little to show for it.
> Troy
> -----Original Message----- > From: haskell-boun...@haskell.org [mailto:haskell-boun...@haskell.org] > On Behalf Of Al Falloon > Sent: Friday, April 27, 2007 12:19 PM > To: hask...@haskell.org > Cc: hask...@haskell.org > Subject: [Haskell] Re: Newbie: what are the advantages of Haskell?
> Taillefer, Troy (EXP) wrote: > > Java sense (i.e. "cut out any feature that can't be understood in > > five
> > minutes by a chimp")
> > Got to love comments like this they are constructive, objective, > > mature and accurate.
> > Glad we have your expert opinion to give us the gospel.
> > Can I get an amen? How about a Hallelujah ?
> Admittedly, this is phrased in an inflammatory manner, however, the > original sentiment is actually pointing out an advantage of Java over > Haskell. Here is the original paragraph in context:
> Sebastian Sylvan wrote: > > I can sometimes feel that Haskell looses out on not being user > > friendly in the Java sense (i.e. "cut out any feature that can't be > > understood in five minutes by a chimp"). Some things do take some > > effort to learn, but there is a huge payoff for it (it's really > > powerful!). But yeah, there might be plenty of folks who will never > > bother learning about them, and they won't understand your code.
> IOW: Java's advanced features are separable from its basic features. > I.e. you can teach Java without teaching generics or anonymous inner > classes. In Haskell, OTOH, you can't even learn how to do IO without > learning Monads, or at least glossing over oddities like a new syntax. > And thats not even getting into issues like statelessness and lazy > evaluation.
> So for a new user, Java is the better language. You can get into its > features slowly and as you see the need for them. Haskell requires you
> to learn a number of mind-bending concepts right up front. Java has a > gentle learning curve and Haskell has a vertical jump.
> But, Sebastian is right. The leap is worth it. Its the same as what > someone once said about LISP: even if you never get to use Haskell > regularly, you will be a better programmer when you finally "get it".
> Derek Elkins wrote: >> And then you come to Haskell and you -can- say, "Give me the something >> that is not there yet."
> Please give me the libraries that are not there yet! *duck*
We wait for people to need the libraries, then a large amount of delayed work is forced. _______________________________________________ Haskell mailing list Hask...@haskell.org http://www.haskell.org/mailman/listinfo/haskell
Al Falloon wrote: > Taillefer, Troy (EXP) wrote: >> Java sense (i.e. "cut out any feature that can't be understood in five >> minutes by a chimp")
>> Got to love comments like this they are constructive, objective, >> mature and accurate.
>> Glad we have your expert opinion to give us the gospel.
>> Can I get an amen? How about a Hallelujah ?
> Admittedly, this is phrased in an inflammatory manner, however, the > original sentiment is actually pointing out an advantage of Java over > Haskell. Here is the original paragraph in context:
> Sebastian Sylvan wrote: >> I can sometimes feel that Haskell looses out on not being user >> friendly in the Java sense (i.e. "cut out any feature that can't be >> understood in five minutes by a chimp"). Some things do take some >> effort to learn, but there is a huge payoff for it (it's really >> powerful!). But yeah, there might be plenty of folks who will never >> bother learning about them, and they won't understand your code.
> IOW: Java's advanced features are separable from its basic features. > I.e. you can teach Java without teaching generics or anonymous inner > classes. In Haskell, OTOH, you can't even learn how to do IO without > learning Monads, or at least glossing over oddities like a new syntax. > And thats not even getting into issues like statelessness and lazy > evaluation.
however, you cannot even print a message without learning a few things about classes. C++ is even worse in this aspect though, using both classes and operator overloading for a hello world. I think the haskell first learning step is quite acceptable if you manage to get the syntax right (beginners tend to mess up indentation rules for do etc)
> So for a new user, Java is the better language. You can get into its > features slowly and as you see the need for them. Haskell requires you > to learn a number of mind-bending concepts right up front. Java has a > gentle learning curve and Haskell has a vertical jump.
> But, Sebastian is right. The leap is worth it. Its the same as what > someone once said about LISP: even if you never get to use Haskell > regularly, you will be a better programmer when you finally "get it".
On Fri, 2007-27-04 at 15:37 -0400, Taillefer, Troy (EXP) wrote: > I really enjoy Functional programming (at least until I try to do > something serious then frustration sets in). I can't produce software in > a timely and cost effective fashion without a large body of high > quality, documented and maintained libraries.
> I get the feeling that Haskell is for researchers to explore ideas about > programming in but no one is interested in doing The grind work of > cranking out useful basic libraries. > I guess you need borrow some of those Java Chimps :).
> Am I the only person on the list that feels this way ?
No. You're not. I wish I knew the language better so I could start working on those libraries. I love the language, but can't use it.
-- Michael T. Richter <ttmrich...@gmail.com> (GoogleTalk: ttmrich...@gmail.com) Never, ever, ever let systems-level engineers do human interaction design unless they have displayed a proven secondary talent in that area. Their opinion of what represents good human-computer interaction tends to be a bit off-track. (Bruce Tognazzini)
> On Fri, 2007-27-04 at 15:37 -0400, Taillefer, Troy (EXP) > wrote:
> I really enjoy Functional programming (at least until I try to do > something serious then frustration sets in). I can't produce software > in a timely and cost effective fashion without a large body of high > quality, documented and maintained libraries.
> I get the feeling that Haskell is for researchers to explore ideas ab > out programming in but no one is interested in doing The grind work of > cranking out useful basic libraries. I guess you need borrow some of > those Java Chimps :).
> Am I the only person on the list that feels this way ?
This is why we have:
* hackage.haskell.org, a centralised library repository, with documentation and src. note that around 15 new libs are appearing each week!
* librar...@haskell.org, for discussing improvements and extensions
* haskell.org/cabal, to ease building new libraries