4 Replies - 2445 Views - Last Post: 17 November 2012 - 12:28 PM

#1 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 8937
  • View blog
  • Posts: 33,473
  • Joined: 12-June 08

[link] Why Haskell?

Posted 16 November 2012 - 09:29 AM

http://net.tutsplus....er/why-haskell/

A pretty thorough shake down of Haskell and it should give you an idea if you want to pick it up and if so where to dip your big toe!

Quote

Being a purely functional language, Haskell limits you from many of the conventional methods of programming in an object-oriented language. But does limiting programming options truly offer us any benefits over other languages?

In this tutorial, we’ll take a look at Haskell, and attempt to clarify what it is, and why it just might be worth using in your future projects.


Is This A Good Question/Topic? 1
  • +

Replies To: [link] Why Haskell?

#2 jon.kiparsky  Icon User is online

  • Pancakes!
  • member icon


Reputation: 7564
  • View blog
  • Posts: 12,693
  • Joined: 19-March 11

Re: [link] Why Haskell?

Posted 16 November 2012 - 09:32 AM

Why Haskell? I can answer that question in three words:

For the smug.
Was This Post Helpful? 0
  • +
  • -

#3 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 8937
  • View blog
  • Posts: 33,473
  • Joined: 12-June 08

Re: [link] Why Haskell?

Posted 16 November 2012 - 09:34 AM

That sort of goes without saying... like driving a Prius hybrid. Hahaha..
Was This Post Helpful? 0
  • +
  • -

#4 ishkabible  Icon User is offline

  • spelling expret
  • member icon




Reputation: 1622
  • View blog
  • Posts: 5,709
  • Joined: 03-August 09

Re: [link] Why Haskell?

Posted 17 November 2012 - 11:58 AM

It's a very interesting, simple, and elegant language that is worth learning. I don't know that I buy into the whole "purely functional is less error prone"; I think that's just functional programmer justification for not having side effects.

here's my take:
*typeclasses and haskell's parametric polymorphism allow for powerful generic programming
*partial application, various combinators, pattern matching, and tagged unions can make for some very terse, expressive, and elegant code
*it's a very simple language with very simple rules at its core.
Was This Post Helpful? 2
  • +
  • -

#5 sepp2k  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2089
  • View blog
  • Posts: 3,179
  • Joined: 21-June 11

Re: [link] Why Haskell?

Posted 17 November 2012 - 12:28 PM

View Postishkabible, on 17 November 2012 - 07:58 PM, said:

I don't know that I buy into the whole "purely functional is less error prone"


Yeah, that's pretty much a red herring. Especially this part:

Quote

If you’ve ever had programs crash on you in the past, then you know that the problem is always related to one of these unsafe operations, such as an error when reading a file, a user entered the wrong kind of data, etc


1. I know no such thing. I've had a lot of programs crash on me for reasons entirely unrelated to IO.
2. Haskell doesn't make it any less likely for a program to crash on invalid input (especially since read causes an exception on invalid input rather than returning a Maybe) and either way purity doesn't help with those issues, safety-conscious API design would.

Haskell does make certain classes of errors (like index out of bounds or null pointer exceptions) less likely than, say, Java or C++ do, but the same is true for impure languages like ML - it has nothing to do with purity.

I mean it's commonly accepted best practice to separate IO code from logic code and it might be argued that purity (or at least Haskell's monadic approach to IO) is helpful because it semi-enforces that separation. But that's really more about maintainability and understandability - not safety. That's not what that section is talking about.

The second section does talk about that, but it's frankly a bit ludicrous. They make it sound as if min and max functions in impure languages would print their result to the screen.

Quote

I think that's just functional programmer justification for not having side effects.


What I don't get is why people feel the need to justify purity like that. Having a lazy language that isn't pure simply wouldn't be feasible. That's all the justification you need.

In my opinion people who claim that purity is superior by itself miss the point a bit. Purity is useful in so far that it enables further features like laziness. I see no reason why you'd make a language pure if you don't need purity for other features.

Oh, and another thing I just noticed in the article:

Quote

In Haskell, there is no support for changing state or mutable data


That's a lie.
Was This Post Helpful? 4
  • +
  • -

Page 1 of 1