Live data from Hacker News

A Year of Functional Programming

japgolly.blogspot.com.au

71–80 of 172 posts

Re: A Year of Functional Programming

#71

Earlier quoted context omitted.

I don't know the OP's examples, but I think he is saying something subtly different: that he took (his own) low-end crappy OO code and converted it to high-end elegant OO code, using the insight gained from how he would have written it as FP.

I didn't get that from the article, but they aren't explicit about it.

I got that too, and that's exactly why I would like to see the code before and after. That's far more interesting than the rest of the article in my opinion.

Re: A Year of Functional Programming

#72
>I've been coding since the age of 8, so 26 years now. >I started with BASIC & different types of assembly then >moved on to C, C++, ...

So to 68002 he had nine and a half or ten, here the article it's enough for me— even I'm interested in FP, but too old.

Re: A Year of Functional Programming

#73
How well does deploying Haskell web applications to a low-memory VPS work? My experience with the Play framework tells me that Scala is out of the question. Presumably using Haskell involves cross-compilation, considering the memory usage of GHC compilation.

Re: A Year of Functional Programming

#74
post #7

I used to like functional programming. Now I think that it's -- more often than not -- a solution in search of a problem. I can understand some of the things FP gets you (although those come at a cost, which I'll get to later); I'm just not so sure these are the things we need, or that FP is the best solution for them. One is code reuse: yes FP code is definitely more reusable. The problem is that the kind of code it…

The lack of magically bug-free, FP OSs, drivers, control software, and large applications, shows that even the biggest supposed benefits of languages like Haskell, are yet to be demonstrated in the real world. I've been reading religious advocacy of FP for almost 15 years now and yet there still don't seem to be many non-trivial apps written in any of these languages. Certainly many individual features of FP have bee…

How about WhatsApp's backend being extremely scalable because it was written in Erlang from the start? Or even Twitter that rewrote much of their backend in Scala to deal with scaling issues (I'm not saying that Rails isn't scalable, I don't want to start a war over this issue; the important thing is they saw a problem and solved it) while contributing many many open sourced libraries for our use?

Foursquare uses Scala extensively. LinkedIn is using Scala extensively for its new projects. The commercial and successful use cases for Scala are widespread at this point. For Haskell and OCaml it's going to take a while.

Re: A Year of Functional Programming

#75
post #42

Earlier quoted context omitted.

The lack of magically bug-free, FP OSs, drivers, control software, and large applications, shows that even the biggest supposed benefits of languages like Haskell, are yet to be demonstrated in the real world. I've been reading religious advocacy of FP for almost 15 years now and yet there still don't seem to be many non-trivial apps written in any of these languages. Certainly many individual features of FP have bee…

They exist, but it's super spotty. HN is written in an FP language for example. One of the airline reservation systems is written in some kind of FP. Reddit was written in a Lisp originally. But like many major FP projects, ended up being rewritten in a more common language. I used to work at a place that had hundreds of thousands of lines of CL code that was all rewritten in Perl and was on its way to getting rewrit…

> One of the airline reservation systems is written in some kind of FP.

You are probably thinking of ITA and their Orbitz service, using Franz Common Lisp. That is not really a FP language, but a good feather in the hat for Lisp nonetheless.

Re: A Year of Functional Programming

#76
post #75
post #42

Earlier quoted context omitted.

They exist, but it's super spotty. HN is written in an FP language for example. One of the airline reservation systems is written in some kind of FP. Reddit was written in a Lisp originally. But like many major FP projects, ended up being rewritten in a more common language. I used to work at a place that had hundreds of thousands of lines of CL code that was all rewritten in Perl and was on its way to getting rewrit…

> One of the airline reservation systems is written in some kind of FP. You are probably thinking of ITA and their Orbitz service, using Franz Common Lisp. That is not really a FP language, but a good feather in the hat for Lisp nonetheless.

Yeah that's it. Well, strike that off the list then I guess.

Re: A Year of Functional Programming

#77
post #4
post #3

Would you recommend starting with Scala before Haskell if one want to learn FP?

No. Actually it would be easier to learn Haskell without knowing any imperative language at all. For me Scala also was "gateway drug to Haskell" and after using Haskell for some time I got some good FP habits which made my Scala/JS/whatever code better.

Haskell made my C code better.

Re: A Year of Functional Programming

#78

It's not that I don't think that programming in a functional style isn't a good idea , it's just that the discussions about functional programming and the languages people use to implement its style so often suggest: If you use language 'x', then using mutation is wrong. and recently, I've been thinking about the practically important but socially awkward question: What language is best for implementing mutable state…

You could look at Rust? It has mutable state but strict ownership which is enforced at compile time.

Re: A Year of Functional Programming

#79
post #7

I used to like functional programming. Now I think that it's -- more often than not -- a solution in search of a problem. I can understand some of the things FP gets you (although those come at a cost, which I'll get to later); I'm just not so sure these are the things we need, or that FP is the best solution for them. One is code reuse: yes FP code is definitely more reusable. The problem is that the kind of code it…

"Haskell discounts the very useful choice of reasoning about your code after it runs, favoring, instead, all-upfront reasoning, often at the expense of facilitating the former. There are some domains where figuring everything up front is very important. Others, where trial and error is far more productive." Yes people seem to learn much better by example. The worst teachers (we have all had them) are those who jump s…

But you can still experiment, you just have the types to guide you as well. And when you realize you got something wrong, you have the types to help you refactor correctly.

Re: A Year of Functional Programming

#80
post #2

" Recently I looked at some code I wrote 8 months ago and was shocked! I looked at one file written in “good OO-style”, lots of inheritance and code reuse, and just thought “this is just a monoid and a bunch of crap because I didn't realise this is a monoid” so I rewrote the entire thing to about a third of the code size and ended up with double the flexibility. Shortly after I saw another file and this time thought…

Real world example:

https://github.com/bitemyapp/bloodhound/blob/master/Database...

https://github.com/bitemyapp/bloodhound/blob/master/Database...

Post reply on HN