Live data from Hacker News

Why Haskell Is Worth Learning

spin.atomicobject.com

31–40 of 114 posts

Re: Why Haskell Is Worth Learning

#31
post #25

I have to admit that I'm really on the fence about Haskell. My major gripe with this point I think is point (3). Haskell has (IMHO) gone down a similar road to Scala. Scala has literally tied itself into knots to make statically typesafe collections (amongst other things). I see parallels with Haskell (maintaining functionality purity but dealing with the "outside world" through monads). I'm not saying this is wrong.…

>I see parallels with Haskell

You are seeing things.

>I'm not saying this is wrong. What I am saying is that the gap between making something 99% consistent and 100% consistent is often huge in terms of complexity.

Haskell is a very simple, very consistent language. That is one of its biggest strengths.

>The answer is (again, IMHO) is that simplicity matters.

Except that lisp is not complex. Especially consider scheme, which is very simple and consistent.

>It's true functional programming does change the way you think but I think writing idiomatic Python or Ruby will get you much the same benefit at much lower cost.

Having gone from "I see the benefits of functional programming, but think a multi-paradigm language is the right way to do it" to outright revulsion when stuck using multi-paradigm languages, I think you might change your mind if you actually tried it. Ocaml and scala certainly sold me on haskell.

Re: Why Haskell Is Worth Learning

#32
post #19

Earlier quoted context omitted.

I'm writing 3 different web apps, plus some command line tools in haskell. I have been working on these projects for a year now, and I've never seen any cabal problems that aren't typical problems that occur with any package manager (trying to install conflicting modules). $ ghc-pkg list | wc -l 182

I felt that way up until last week! I somehow felt I was special, that cabal-hellfires had burnt a ring around me. Then next thing I knew I had a 4 page cabal conflict problem and had to just toast .ghc and .cabal and start over. It's a real problem.

Your response makes it sound like you just had a simple problem like you get with any language, and followed bad advice on solving it based on the assumption that "cabal is just bad and you have to do this". The big give away is that you didn't need to delete your .cabal directory, advice to do so is coming from someone who doesn't know the basics of how cabal works. It is just storing downloaded sources, all deleting it accomplishes is making you re-download stuff for no reason. The installed packages are in your .ghc directory. Cabal is no more broken than cpan.

Re: Why Haskell Is Worth Learning

#33
post #25

I have to admit that I'm really on the fence about Haskell. My major gripe with this point I think is point (3). Haskell has (IMHO) gone down a similar road to Scala. Scala has literally tied itself into knots to make statically typesafe collections (amongst other things). I see parallels with Haskell (maintaining functionality purity but dealing with the "outside world" through monads). I'm not saying this is wrong.…

You can write simple scala, if you use case classes, type inference, wildcards, optional parens/periods, return "this" to make little pointfree method chains etc. You also need to avoid parameterized types and many corners of the type system that go with them. Look in Subramaniam's Pragmatic Press book on scala, you'll see lots of simple code that any ruby/PHP dev can grok, for analytics, sysadmin etc.

Now it's true that a lot of people don't choose to write simple scala. Scala has a lot of features that other language designers know they need. Look how proud Hjelsberg was of co- and contravariance in C# 4.0 (I don't have a video waypoint, it's about 2/3 of way thru

http://channel9.msdn.com/Blogs/matthijs/C-40-and-beyond-by-A...

(Also look at Learn You Haskell, for pretty straightforward haskell code (straightforward because he didn't have page-space to go into a lot of GHC extensions and advanced stuff)

Re: Why Haskell Is Worth Learning

#34
post #7
post #5

Relevant points on Haskell, from another discussion, and sort of echoes my own thoughts: http://news.ycombinator.com/item?id=5314701 http://news.ycombinator.com/item?id=5314507

At university the very first language we are taught is Haskell. Lots of people had never programmed before, in anything and everyone managed fine. Nothing scary at all, no need for an understanding of category theory or anything. Monads are (fairly) simple things that just have a really bad reputation, partly the fault of the haskell docs which make them seem complex. Firstly: Functors are things we can map over in a…

I know monads are supposed to be simple, but I've been playing with Haskell on and off for years now and I still can't figure out how do-notation desugars into >>= operations.

Re: Why Haskell Is Worth Learning

#35
post #17

I investigated Haskell for a while and as long as I didn't try to add any libs it was fun. However once I started using cabal to try and manage dependencies all hell broke loose. Obviously it takes a while to get it right (looking at you SBT and Ruby gems) but Haskell has been around forever.

I'm writing 3 different web apps, plus some command line tools in haskell. I have been working on these projects for a year now, and I've never seen any cabal problems that aren't typical problems that occur with any package manager (trying to install conflicting modules). $ ghc-pkg list | wc -l 182

Don't want to turn this into Stack Exchange and this may be homebrew's fault on OS X but I just tried installing 'haskell-platform' and got:

  Error:
  Building the QuickCheck-2.5.1.1 package failed
  make: *** [build.stamp] Error 2
Ok I will install the package on haskell.org, which instructs me to 'To upgrade, run: cabal install cabal-install':

  ...

  cabal: Error: some packages failed to install:
  cabal-install-1.16.0.2 failed during the building phase. The exception was:
  ExitFailure 1
Alright, maybe I don't really need the update, let's try yesod:

  cabal: Error: some packages failed to install:
  ReadArgs-1.2.1 depends on system-filepath-0.4.7 which failed to install.
  aeson-0.6.1.0 depends on hashable-1.2.0.5 which failed to install.
  asn1-data-0.7.1 failed during the building phase. The exception was:
  ExitFailure 1
  attoparsec-0.10.4.0 failed during the building phase. The exception was:
  ExitFailure 1
  attoparsec-conduit-1.0.0 depends on transformers-base-0.4.1 which failed to
  install.
  authenticate-1.3.2.6 depends on zlib-bindings-0.1.1.3 which failed to install.
  base64-conduit-1.0.0 depends on transformers-base-0.4.1 which failed to
  install.
  basic-prelude-0.3.4.0 depends on transformers-base-0.4.1 which failed to
  install.
  blaze-builder-0.3.1.0 failed during the building phase. The exception was:
  ExitFailure 1
  blaze-builder-conduit-1.0.0 depends on transformers-base-0.4.1 which failed to
  install.
  blaze-html-0.6.0.0 depends on blaze-builder-0.3.1.0 which failed to install.
  blaze-markup-0.5.1.4 depends on blaze-builder-0.3.1.0 which failed to install.
  case-insensitive-1.0 depends on hashable-1.2.0.5 which failed to install.
  certificate-1.3.5 depends on crypto-api-0.11 which failed to install.
  classy-prelude-0.5.3 depends on transformers-base-0.4.1 which failed to
  install.
  clientsession-0.8.1 depends on crypto-api-0.11 which failed to install.
  conduit-1.0.2 depends on transformers-base-0.4.1 which failed to install.
  cookie-0.4.0.1 depends on blaze-builder-0.3.1.0 which failed to install.
  cprng-aes-0.3.4 depends on crypto-api-0.11 which failed to install.
  crypto-api-0.11 failed during the building phase. The exception was:
  ExitFailure 1
  crypto-conduit-0.5.0 depends on transformers-base-0.4.1 which failed to
  install.
  crypto-pubkey-0.1.2 depends on crypto-api-0.11 which failed to install.
  cryptohash-0.8.3 depends on crypto-api-0.11 which failed to install.
  css-text-0.1.1 depends on attoparsec-0.10.4.0 which failed to install.
  email-validate-1.0.0 depends on attoparsec-0.10.4.0 which failed to install.
  failure-0.2.0.1 failed during the building phase. The exception was:
  ExitFailure 1
  fast-logger-0.3.1 depends on blaze-builder-0.3.1.0 which failed to install.
  filesystem-conduit-1.0.0 depends on transformers-base-0.4.1 which failed to
  install.
  fsnotify-0.0.6 depends on system-filepath-0.4.7 which failed to install.
  hamlet-1.1.6.3 depends on shakespeare-1.0.3.1 which failed to install.
  hashable-1.2.0.5 failed during the building phase. The exception was:
  ExitFailure 1
  hfsevents-0.1.3 failed during the building phase. The exception was:
  ExitFailure 1
  hjsmin-0.1.4.1 depends on blaze-builder-0.3.1.0 which failed to install.
  hspec-1.4.4 failed during the building phase. The exception was:
  ExitFailure 1
  html-conduit-1.1.0 depends on xml-types-0.3.3 which failed to install.
  http-conduit-1.9.0 depends on zlib-bindings-0.1.1.3 which failed to install.
  http-date-0.0.4 depends on attoparsec-0.10.4.0 which failed to install.
  http-reverse-proxy-0.1.1.3 depends on zlib-bindings-0.1.1.3 which failed to
  install.
  http-types-0.8.0 depends on hashable-1.2.0.5 which failed to install.
  language-javascript-0.5.7 depends on blaze-builder-0.3.1.0 which failed to
  install.
  lifted-base-0.2.0.2 depends on transformers-base-0.4.1 which failed to
  install.
  mime-mail-0.4.1.2 depends on blaze-builder-0.3.1.0 which failed to install.
  mime-types-0.1.0.3 failed during the building phase. The exception was:
  ExitFailure 1
  monad-control-0.3.1.4 depends on transformers-base-0.4.1 which failed to
  install.
  monad-logger-0.3.0.1 depends on transformers-base-0.4.1 which failed to
  install.
  network-conduit-1.0.0 depends on transformers-base-0.4.1 which failed to
  install.
  optparse-applicative-0.5.2.1 failed during the building phase. The exception
  was:
  ExitFailure 1
  path-pieces-0.1.2 failed during the building phase. The exception was:
  ExitFailure 1
  pem-0.1.2 depends on attoparsec-0.10.4.0 which failed to install.
  persistent-1.1.5.1 depends on transformers-base-0.4.1 which failed to install.
  persistent-template-1.1.2.4 depends on transformers-base-0.4.1 which failed to
  install.
  pool-conduit-0.1.1 depends on transformers-base-0.4.1 which failed to install.
  project-template-0.1.3 depends on transformers-base-0.4.1 which failed to
  install.
  publicsuffixlist-0.0.3 failed during the building phase. The exception was:
  ExitFailure 1
  pureMD5-2.1.2.1 depends on crypto-api-0.11 which failed to install.
  pwstore-fast-2.3 depends on crypto-api-0.11 which failed to install.
  resource-pool-0.2.1.1 depends on transformers-base-0.4.1 which failed to
  install.
  resourcet-0.4.5 depends on transformers-base-0.4.1 which failed to install.
  shakespeare-1.0.3.1 failed during the building phase. The exception was:
  ExitFailure 1
  shakespeare-css-1.0.3 depends on shakespeare-1.0.3.1 which failed to install.
  shakespeare-i18n-1.0.0.2 depends on shakespeare-1.0.3.1 which failed to
  install.
  shakespeare-js-1.1.2.1 depends on shakespeare-1.0.3.1 which failed to install.
  shakespeare-text-1.0.0.5 depends on shakespeare-1.0.3.1 which failed to
  install.
  simple-sendfile-0.2.11 failed during the building phase. The exception was:
  ExitFailure 1
  skein-0.1.0.12 depends on crypto-api-0.11 which failed to install.
  socks-0.5.0 failed during the building phase. The exception was:
  ExitFailure 1
  system-fileio-0.3.11 depends on system-filepath-0.4.7 which failed to install.
  system-filepath-0.4.7 failed during the building phase. The exception was:
  ExitFailure 1
  tagsoup-0.12.8 failed during the building phase. The exception was:
  ExitFailure 1
  tagstream-conduit-0.5.4 depends on transformers-base-0.4.1 which failed to
  install.
  tls-1.1.2 depends on crypto-api-0.11 which failed to install.
  tls-extra-0.6.1 depends on crypto-api-0.11 which failed to install.
  transformers-base-0.4.1 failed during the building phase. The exception was:
  ExitFailure 1
  unordered-containers-0.2.3.0 depends on hashable-1.2.0.5 which failed to
  install.
  vault-0.2.0.4 depends on hashable-1.2.0.5 which failed to install.
  wai-1.4.0 depends on transformers-base-0.4.1 which failed to install.
  wai-app-static-1.3.1.2 depends on transformers-base-0.4.1 which failed to
  install.
  wai-extra-1.3.2.4 depends on zlib-bindings-0.1.1.3 which failed to install.
  wai-logger-0.3.0 depends on transformers-base-0.4.1 which failed to install.
  wai-test-1.3.0.4 depends on transformers-base-0.4.1 which failed to install.
  warp-1.3.7.4 depends on transformers-base-0.4.1 which failed to install.
  xml-conduit-1.1.0.3 depends on xml-types-0.3.3 which failed to install.
  xml-types-0.3.3 failed during the building phase. The exception was:
  ExitFailure 1
  xss-sanitize-0.3.3 depends on tagsoup-0.12.8 which failed to install.
  yaml-0.8.2.3 depends on transformers-base-0.4.1 which failed to install.
  yesod-1.1.9.2 depends on zlib-bindings-0.1.1.3 which failed to install.
  yesod-auth-1.1.5.3 depends on zlib-bindings-0.1.1.3 which failed to install.
  yesod-core-1.1.8.2 depends on zlib-bindings-0.1.1.3 which failed to install.
  yesod-default-1.1.3.2 depends on zlib-bindings-0.1.1.3 which failed to
  install.
  yesod-form-1.2.1.3 depends on zlib-bindings-0.1.1.3 which failed to install.
  yesod-json-1.1.2.1 depends on zlib-bindings-0.1.1.3 which failed to install.
  yesod-persistent-1.1.0.1 depends on zlib-bindings-0.1.1.3 which failed to
  install.
  yesod-platform-1.1.8 depends on zlib-bindings-0.1.1.3 which failed to install.
  yesod-routes-1.1.2 depends on path-pieces-0.1.2 which failed to install.
  yesod-static-1.1.2.2 depends on zlib-bindings-0.1.1.3 which failed to install.
  yesod-test-0.3.5 depends on xml-types-0.3.3 which failed to install.
  zlib-bindings-0.1.1.3 failed during the building phase. The exception was:
  ExitFailure 1
  zlib-conduit-1.0.0 depends on zlib-bindings-0.1.1.3 which failed to install.
If I'm yak-shaving in my first hour of trying a language out it's not a good sign.

Re: Why Haskell Is Worth Learning

#36
post #35

Earlier quoted context omitted.

I'm writing 3 different web apps, plus some command line tools in haskell. I have been working on these projects for a year now, and I've never seen any cabal problems that aren't typical problems that occur with any package manager (trying to install conflicting modules). $ ghc-pkg list | wc -l 182

Don't want to turn this into Stack Exchange and this may be homebrew's fault on OS X but I just tried installing 'haskell-platform' and got: Error: Building the QuickCheck-2.5.1.1 package failed make: *** [build.stamp] Error 2 Ok I will install the package on haskell.org, which instructs me to 'To upgrade, run: cabal install cabal-install': ... cabal: Error: some packages failed to install: cabal-install-1.16.0.2 fai…

You have to scroll back to see the actual error. That could be anything from missing C libraries to a permission problem.

Re: Why Haskell Is Worth Learning

#37
post #16

I was thinking about this the other day and I think it generalizes beyond any specific language. I'm pretty sure every time I have learned a new programming language I came away a better programmer. Different programming languages (and their standard libraries) suggest that you approach problems in different ways, and that has real cognitive benefits. I was actually trying to think if there was ever a case where I ha…

There's not much value in learning programming languages that are similar. If you learn Ruby, you already know pretty much everything there is to know about Python. If you learn Java, you already know much about C#. The only real value you can get out of learning new mainstream languages is from learning the architecture of popular libraries. Like when I was inspired a few years ago to do database migrations after I played around with Rails.

So you end up learning from the libraries written in those languages, not the languages themselves. It isn't a bad outcome, especially since learning a new language that's similar to something you already know becomes second nature and doesn't take too long. It takes me something like 2 weeks to learn a new language.

Haskell is on a whole new level though. I don't know Haskell, but in the last couple of months I've been building stuff with Scala and lots of functional programming related idioms, both for personal stuff and for our startup and I've learned more than I learned in the last 5 years. There's lots of good stuff to learn in the Scala ecosystem, like how to build rock solid pieces of functionality with referential transparency, how to work with Futures/Promise, how to do concurrency with shared-transactional memory, how to do non-blocking and safe I/O using Iteratees, how functional data-structures are designed and so on.

Of course, Scala is tainted by its hybrid and JVM-related nature. It's much too easy to cheat if it's easier than alternatives that are referentially transparent and even if your interface is pure, that interface is probably wrapping something which isn't pure. In practice it works great for building stuff, but unfortunately I'll have to take the plunge and learn Haskell to be able to take my knowledge to the next level.

One example where Scala falls short is in its implementation of lazy data structures. You see, even though Scala does have really good lazy data structures, it cheats here and there because it makes sense to do so ... like for instance a Stream is a lazy list and it does behave lazily, except when it doesn't. sort() on a lazy stream is actually implemented eagerly, which means algorithms using sort() will not have the complexity characteristics of lazy algorithms. There's nothing stopping one from implementing a lazy sort() in Scala, but it's probably not going to have any benefits so people don't do that. That's actually the reason why I want to learn Haskell, because the best implementations for lazy data-structures and algorithms are written in Haskell.

Many idioms that people use now in Scala or in other languages have been used in Haskell since years ago. Like Iteratees or type-classes.

Re: Why Haskell Is Worth Learning

#38
post #13
post #3

Earlier quoted context omitted.

The skill of breaking down large functions into smaller simple functions is a common skill of programming and should be practiced in all languages (C, Java, Python, etc). I'm not really sure from the article what I am supposed to gain by learning Haskell. I'm not debating the opinion that Haskell is great language to learn, but the benefits of learning the language were not clear to me after reading the article. Does…

"The skill of breaking down large functions into smaller simple functions is a common skill of programming and should be practiced in all languages (C, Java, Python, etc)" Haskell will show you that when you thought you broke your code down into small functions in those languages, you were wrong in ways you currently can't even see and they're still shot through with duplication and mixing of concerns. This is really…

Learning Haskell taught me that mutation and state are good things, present both in the fundamental nature of computers and the real world. Haskell's attempts to eliminate state entirely results in a profound increase in complexity.

For me, learning Haskell was like visiting a third-world country: enlightening, very different, but ultimately I leave feeling very grateful that I'm not a permanent resident. All in all, I would recommend the experience.

Re: Why Haskell Is Worth Learning

#39
post #25

I have to admit that I'm really on the fence about Haskell. My major gripe with this point I think is point (3). Haskell has (IMHO) gone down a similar road to Scala. Scala has literally tied itself into knots to make statically typesafe collections (amongst other things). I see parallels with Haskell (maintaining functionality purity but dealing with the "outside world" through monads). I'm not saying this is wrong.…

hmmm - your measure of "complexity" is not the consensus one.

Scala has a lot of machinery in its type system, and Haskell has very little. LISP has even less.

Scala may have been inspired by Haskell in some ways, but the experience of writing it is very different.

Re: Why Haskell Is Worth Learning

#40
post #19

Earlier quoted context omitted.

I'm writing 3 different web apps, plus some command line tools in haskell. I have been working on these projects for a year now, and I've never seen any cabal problems that aren't typical problems that occur with any package manager (trying to install conflicting modules). $ ghc-pkg list | wc -l 182

I felt that way up until last week! I somehow felt I was special, that cabal-hellfires had burnt a ring around me. Then next thing I knew I had a 4 page cabal conflict problem and had to just toast .ghc and .cabal and start over. It's a real problem.

you could look into hsenv and cabal-dev.

https://github.com/cakesolutions/the-pragmatic-haskeller

http://bob.ippoli.to/archives/2013/01/11/getting-started-wit...

Also, problems in the haskell ecosystem don't stay problems for long, this one is the longer end of the tail

http://alpmestan.com/posts/2012-11-02-cabal-hackage-what-you...

Post reply on HN