1. 9

I know C, C++, Java, Python, Javascript, and GoLang. I am planning to learn a functional language. I am thinking of Erlang, Lisp, Haskell, and Closjure. I don’t know any of them. I have heard that Lisp is great but it seems Erlang is more popular for building large scale systems. While Haskell seems to be pretty popular too.


  2. 15

    Haskell is a fascinating language that will give you a better understanding of functional programming concepts than other languages. Learn you a Haskell for Great Good is a great resource for beginners:


    1. 3

      Worked at a Scala shop, been into functional programming for years. I’ll safely say that The Haskell Book is when a lot of the more esoteric words of FP “click” into place for me.


      1. 2

        If you like concise writing, however, I recommend Hutton’s and Bird’s books for learning Haskell.

      2. 2

        I worked through LYAH and really enjoyed it. However, I’m feeling a bit stuck. The code I see online has difficult to grok language extensions, like existential quantification. Or complicated type based approaches like Servant. I even struggle to understand how the json library Aeson works.

        What’s a good next step if I’d like to become proficient?

        1. 3

          Shameless plug for the Applied FP Course :) (disclaimer: I wrote it) Staged levels designed for the gap between intro material and building things that squeak and move. There’s lots of helpful peoples that lurk in the #qfpl #haskell-beginners channesl on IRC, or one of the no-doubt several FP discords. :)

          1. 2

            What’s a good next step if I’d like to become proficient?

            In my experience? Start writing real projects in Haskell, work with other Haskellers. You can also use these resources.

        2. 9

          I’d vote for Haskell, because it really forces you to think functionally. With other languages it’s too easy to fall back to using side effects, and sometimes you might not even realize you’re doing it.

          One can debate whether going all-in on purity is the right way to structure programs, but Haskell will at least force you to learn that style of programming so you can be the most informed.

          Compared to the other languages you listed, Haskell also has the benefit of having a strong type system. This is another way to learn about functional programming. For example, in Haskell you can directly express the concept of “functor”, whereas those other languages don’t provide a real way to do that. I think one of the main reasons that monads are so difficult for people to understand is because people don’t have a language in which it’s even possible to express “monad” as a concept. But in Haskell it’s 3 short lines of code.

          1. 8

            Lisp is about as functional as Javascript. You can do functional programming, but it’s neither too comfortable (out of the box) or efficient as a mixed approach. Scheme and Clojure less so. I can’t say much about Erlang.

            I think the best bet is Haskell. Just learning the basics is very interesting by itself, but I don’t thin you’ll get to production-level code in 30 days. I’ve been engaging with the language for 5 years, sometimes more sometimes less, but when I see a real-world application on GitHub or wherever, it’s a totally different thing. I don’t know what the reasons are, but it’s (like) a totally different language.

            So ultimately, I’d recontextualize the question. It’s a slim chance to become an industrial functional programmer in a month, but it’s more than enough time to challenge and change conceptions about programming and software design. If you choose something like Lisp, you can basically be productive without learning anything. Every approach can be translated. But with Haskell, you’ll be forced to start all over again, and that’s a really fun experience. Because it’s like consciously going through learning programming from the beginning, and reflecting on what you already know.

            (Also nitpick, it’s still “Go”, not “Golang” or “GoLang”).

            1. 1

              How do you see Lisp being as functional as JS? JS can be used in a completely non-FP way like I have never seen a Lisp being used.

              1. 2

                Javascript famously was supposed to be more of a Scheme-like language, until executives at Netscape thought it would be more popular if it looked like Java or a C-like language. And you still see the effects of this, as hooks (onclick = function () { ... }) is still how a lot of web-javascript works. And if you want to see non-functional Lisp, look at somewhat efficient Elisp code. But Common Lisp has it too, one if it’s most powerful macros, setf and co., are all about mutating state.

            2. 4

              All of these languages will teach you interesting things, and expose you to new ways of solving problems. My personal preference is Clojure as it’s a very practical language that targets a number of popular runtimes. It’s also gets a fair bit of industry use, so you can reasonably expect to land a job using it. I wrote about some of the reasons why I’ve stuck with the language here, and here are some beginner resources if you decide to give it a shot.

              1. 4

                Haskell mended my brain. Not just because of, as mentioned already, being pure functional, and the (at least partly) resulting very rich type system, but also because it is lazy by default.

                The other languages are nice, too, but if your goal is to learn functional programming, I’m not sure they will have the full effect.

                1. 3

                  All Erlang programs are valid Elixir. You can learn many of the same concepts as Lisp and Haskell w/o the tooling head aches. Lots will transfer and it has an easier learning curve. After spending some time with Elixir and its macro system, you could spend some time with other languages on the Beam like

                  1. 3

                    Haskell is fascinating, but unless you’re the world’s fastest speed reader you’re barely going to touch the surface in 30 days. Things like learnyouahaskell are relatively tractable, but woefully incomplete. The haskellbook is more thorough and will get you to beginner-level fluency, but is LONG, opinionated, verbose, and the actual practice exercises are poorly described with no official answer key so you’ll never actually know if you’ve done something sensible, only that it compiles. Oh, and library documentation is, on average, utterly useless… you NEED fluency in the type system at least equal to that of the author of any given library to have a hope of using anything outside the most commonly used libraries, because working examples are either unheard of or scorned.

                    Don’t get me wrong, it’s an absolutely fascinating language and well worth the investment… but 300 days is a much more realistic estimate of the investment required to achieve minimal fluency and productivity.

                    Personally, and in hindsight, with 30 days I’d read SiCP and take a shallow dive into a Lisp derivative like Scheme or Racket. Or, if you can’t hack the parentheses, then an ML derivative like OCaml. Any of those will serve as a foundation for FP.

                    Erlang is also fascinating, but it’s really kind of wildly different than anything else out there, due to both its execution model and it’s weird(er) syntax. But you’ll be more productive in 30 days with it than you will be with Haskell.

                    1. 2

                      It’s almost been 30 days. How’s it going?

                      1. 2

                        What are your goals? Are your goals to bend your mind? Improve your skills? Change your first language? Switch careers / jobs? It’s hard to give you real advice here without more context. Racket, Erlang, Haskell, OCaml, Scala, Clojure – all of these would be good to explore and learn, but which one depends completely on your end goal.

                        1. 2

                          Purely learning the functional programming mindset. I have heard this phrase quite a few times. Being eventually able to build something production-quality would be great.

                          1. 8


                            1. If you want to stretch your mind the most, I’d say Haskell. Haskell is lazily evaluated, and gives no fucks about the way you’ve programmed before. You can do “stateful” things only inside a specific box, and you’re forced to deal with foreign concepts almost immediately.

                            2. Clojure would force lots of the “functional” bits on you around referential transparency, and provides lots of higher order thinking opportunities. It’s practical to boot as it gives you access to the entirety of the Java / JVM ecosystem, in a dynamically typed “candy shell”.

                            3. Racket, on the other hand, has amazing learning materials, opt-in gradual typing (via Typed Racket), contracts, and an extremely powerful language construction kit with its hygienic macro system, and first class languages support. There are many, both high quality, and toy quality languages built in Racket that can demonstrate functional concepts. A great example of this: hackett, which implements as Haskell like language in Racket, pie which is the language from The Little Typer, and even a Datalog.

                            1. 2

                              If you are the kind of person who learns by inflicting pain on themselves (like the “if you want to start vim, disable your arrow keys” people), then start with something like Haskell which might annoy you to no end.

                              If you are the kind of person who likes to easily transition into things and learn step by step (or is easily frustrated if the thing you want to do takes 5min in your language and you give up after 3h in the new language…) then I’d suggest something like Clojure, where you can easily reach for the Java interop and if bad comes to worst just write one or two Java classes that you embed and then come back and rewrite it.

                              It’s probably not hard to discern which kind of person I am :) When learning a new language I’m totally fine with writing unidiomatic code for a while and just getting a feel, then improving by rewriting.

                          2. 1

                            Elixir has a ton of promise and fantastic tooling to get your first program started

                            1. 1

                              Try PROLOG, if you manage to explore it deeply enough, it changes the way you think about programming.

                              1. 0

                                I know it’s not what you’re asking, but still: Do you know any assembler? If not, I’d say to consider learning one.

                                1. 2

                                  Thankfully, I know assembly for both X86 and for Atmel microcontrollers.