9 ms·
No. It's a great way to turn people off from the whole idea. I suffered through a course in Haskell and functional programming in college, and the course mate
by megaman22 9y ago
No. It's a great way to turn people off from the whole idea.
I suffered through a course in Haskell and functional programming in college, and the course material was so up its own butt about monads and type classes and algebraic data types and such, that I essentially wrote the whole thing off as academic flubbery. It didn't help that whatever version of GHC we had then gave off error messages more cryptic than C++ template metaprogramming, and it was such a cluster to have to bounce into the IO monad to just to do some intermediate printf debugging.
It wasn't until years later and exposure to .NET LINQ that it started to click and the motivations for why you would want to use functional programming became apparent.
- TuringTest 9y agoI studied Haskell in college (with the Gofer variant), and it was GREAT for learning practical functional programming. We didn't use monads though (they weren't in widespread use back then), so we had to learn the accumulator-parameter pattern and tail recursion the hard way. Learning my foldr's and foldl's and zipwith's gave me confidence that almost any imperative programming can be equally represented as a recursive function, which is an important lesson for someone who had only learned about traditional imperative programming and OOP up to that point. Of course, a proper course should center around algorithms and recursive data structures where functional programming shines; it should not begin with building business application logic, for which a classic language may have a gentler ramp-up.
- HelloNurse 9y agoIf your course didn't cover monads, it was a very introductory one which would have probably benefited from choosing a nicer and simpler language, like antiquated LISP or maybe Scheme.
- deleted 9y ago[deleted]
- TuringTest 9y agoIt was introductory, yes, although it also covered relational programming in PROLOG. I benefited from the type inference/type declarations, and learning about generics explained in a non-duck-typing way, though, which I wouldn't have had in LISP.
- wwweston 9y agoHey, can you point to or do you have any of the relational/Prolog programming materials? I dabbled in this years ago, mostly experimenting on my own, would love to see some materials designed for guided exploration.
- TuringTest 9y agoI'm afraid the material is some handwritten notes in Spanish, interleaved with some code examples in PROLOG. They were quite systematic IIRC, covering basic logic, data structures, proper use of the !bang for performance, etc. I no longer have the exercises in code, just paper. I've yet to scan my handwritten notes and bring them to the digital era :-) This may prompt me to finally do it. If you still want them, I can send you the scanned pdf to your mail. However, I think you'd better off with some free online course. On a cursory examination, this one seems similar to the content in my notes: [1] http://www.learnprolognow.org/lpnpage.php?pageid=online http://www.learnprolognow.org/lpnpage.php?pageid=online
- reddit_clone 9y ago> antiquated LISP That's debatable. True, Lisp is Old. Hardly antiquated.
- HelloNurse 9y agoI agree, but over the decades LISP developed significant complications, such as object oriented features; I think the most appropriate LISP for an introductory FP course would be a very antiquated and very simple and pure one, without advanced features (and the accompanying syntactic pollution) that might be of interest as advanced theory, useful in advanced practice, but a source of confusion and a major waste of time for beginners. Fancy LISP variants would still be vastly easier to learn than Haskell, but a straightforward computer adaptation of lambda calculus would minimize the distance between theory and running programs. I'm not familiar enough with Scheme or Clojure to tell whether they are too complex for an introductory course.
- flavio81 9y ago>I agree, but over the decades LISP developed significant complications, such as object oriented features How can this be a complication? On Common Lisp, you can just choose not to use object oriented features (the CLOS system). There are many CL libraries that do not use OOP code at all. And if you want to use them, in CLOS a method is called exactly the same as a function; they are called "generic functions", so the syntax is just the same. >without advanced features (and the accompanying syntactic pollution) I don't think there is any syntactic pollution. Again, in Common Lisp the syntax is totally uniform for all the features, in fact for a beginners' Functional Programming course, he/she would only need to learn: () parentheses for opening and closing an s-expression ; for comments ' for quoting an s-expression so it is not evaluated #' for indicating that the following symbol is a function name (not needed on Lisp-1 languages like Scheme) "" for delimiting a string ... and that's it!! "Advanced" features don't introduce too much syntax either: ` for quoting an s-expression in a "template" way (i.e. for use in macros) , for escaping the ` operator ,@ for escaping the ` operator, "splicing" the contents of a list; for example when passing a code block to a macro. For a language that is really extensive in features, the amount of syntax introduced is minimal, really. Compare with Haskell.
- DonaldFisk 9y ago> antiquated LISP By that do you mean "Lisp, which is antiquated", or "a LISP which is antiquated"? Lisp certainly isn't antiquated, but as the second oldest high level language after FORTRAN, there are antiquated versions of it (e.g. LISP 1.5).
- Chattered 9y agoWadler's introductory Haskell course at Edinburgh doesn't cover monads, but it's great. I don't want to use scheme because I want students exposed to a decent static type system. There's an argument to be made for using standard ml, maybe. I think the fact that strings are linked lists is great for beginners. One of their assignments is on web scraping, where they can reuse all their list based functions to solve the problem. I am not too keen on Haskell's polymorphism for teaching beginners, and error messages are mostly useless for them. If I were teaching again, I would be recommending custom preludes with simpler types.
- krfsm 9y agoThere were courses using haskell before monads were the smash hit they are now. In particular haskell didn't have monadic IO then. On the other hand, variants such as gofer were pretty simple.
- deleted 9y ago[deleted]
- mpfundstein 9y ago1000000 times this! I learned FP (Functors, Monads, Applicatives etc. )through Javascript (Dr. Booleans adequate guide) and it was an eye-opener. Still no love for Haskell!
- fakedrake 9y agoTypeclasses and parametric types are there to leverage the typesystem. It's hard to see how you can benefit from these abstractions if all you have is ducktyping.
- zwerdlds 9y agoNot a genuine answer, but JavaScript has a great ability to inspire respect for type systems, due to that duck typing. I suppose the GP enforced it manually?
- hota_mazi 9y agoJavascript doesn't support duck typing. It doesn't support any typing actually: it's dynamically typed. If Javascript can inspire respect for type systems, it's by making you realize that not having type annotations leads to terrible, unmaintainable code.
- zwerdlds 9y agoYes, that was my point.
- gnaritas 9y ago> Javascript doesn't support duck typing. It doesn't support any typing actually: it's dynamically typed. Dynamically typed doesn't mean untyped; you still have types in JavaScript. Most dynamic languages are strongly typed, not untyped. You're conflating a few unrelated things. JavaScript is duck typed, as virtually all dynamic languages are.
- seanmcdirmid 9y ago
- lokerfoi 9y agoWith unsafePerformIO you can do printf anywhere. There's also Debug.Trace.
- sotojuan 9y agoI had the opposite experience, but I used Chris Allen's book instead of a university course. A lot of concepts I had been using in Elixir and even JS did not click until I worked through Mr Allen's book.
- kungito 9y agoI enjoyed learning Haskell in an optional advanced course at our uni. The things which I like the most are higher order functions, playing with pointfree, combinator libraries, typeclasses, pattern matching and higher order types. Only later did I click with monads and some other patterns like phantom types and such. I think the sad part about learning Haskell is that everyone gets so up about monads while they definitely aren't the most important part but only one of many beautiful and magical parts of Haskell. Maybe if people stopped talking about monads so much and more about other parts of the language would people be way better at learning the language.
- marcosdumay 9y ago> they definitely aren't the most important part They are that small piece that makes everything fit together and work. If you ignore it, you will have many problems down the line. Yet, you are right, they aren't all that interesting by themselves.
- bad_user 9y agoWhile I agree that many courses on Haskell are no good ... >> "up its own butt about monads and type classes and algebraic data types" Well, those are some of the best things about doing functional programming in languages that can afford them. >> "I essentially wrote the whole thing off as academic flubbery" And maybe it was your attitude to the whole thing. >> "It wasn't until years later and exposure to .NET LINQ that it started to click..." So seriously, can't you find anything else that changed "years later"? Haven't you changed? Aren't we talking about years of accumulated experience? Also, .NET LINQ might be a cool example of what you can do with FP, there are elements of FP in it, certainly that's a monadic interface that makes it tick. But filtering an IEnumerable or an IQueryable is as interesting as executing an SQL query. What have you learned about FP from executing SQL queries? Probably nothing. Just saying.
- NightMKoder 9y agoFunctional languages and strongly typed languages are not the same set. Most functional languages focus on typing (e.g. Haskell, Scala), but there are functional languages that do not (e.g. Clojure, Common LISP). You can easily do functional programming in clojure without using any monad concepts directly (though obviously it’s easy to say “that’s just a monad” in a lot of cases). IMO the biggest win from functional programming is referential transparency. Automated verification (i.e. type checking) can definitely be useful on larger projects with bigger teams since it’s self documenting. That’s just my personal take on it though - there’s plenty for everyone to like.
- bad_user 9y agoYou're mentioning Clojure. Clojure has protocols which are probably inspired by type classes. Just like Clojure's protocols, type classes are a mechanism for ad hoc polymorphism that allows decoupling between data and the functions operating on that data. Clojure indeed doesn't have monads, but this has to do with Clojure's culture (like all LISPs) of using macros for describing APIs for composing stuff. But those APIs aren't unified and some of the DSLs I've seen do not have a theoretical foundation, which really means they aren't reusable and some of them are flawed. Due to its evolution and backwards compatibility concerns, some of its design shows its age as well. You can't make operations like "map" work on your own data types because it doesn't have a protocol defined for it. Don't get me wrong, I actually like Clojure, but that the community is not using types like monads to drive their design is a flaw.
- alexeyzab 9y agoI tried learning Haskell by reading LYAH and doing some of the cis194 course, it was alright, but I was struggling. Then I bought Haskellbook (Haskell Programming from first principles). Took me a while to finish it, but I had a great time doing it. I learned Haskell and was able to jump right into writing my first library with it. And I come from a non-CS background with only a bit of Ruby prior to that. The quality of your learning materials matters a lot.
- aaron-lebo 9y agoIt's great but also 1300 pages (and $60, well-deserved).
- bontaq 9y agoI'm about ~300 pages into it and it's been really enjoyable. "Pure functional programming without fear or frustration" is so right. I've started to look forward to the couple pages I get through each day after work, it's legitimately relaxing.
- woolvalley 9y agoAt least you had documentation, books and a community to ask questions from. We had SML which had none of that. I wish we used Ocaml, that at least had something of an active community. Haskell would of been even better.
- cujic9 9y agoI agree. Functional programming should not be viewed as a tuxedo that we dust off and use when we want to be "fancy programmers." It's simply a tool in the toolbox. The best language for learning functional programming is the one that de-mystifies it. And since you can use many (most?) popular languages to code in a functional style, I'd say, take whatever language the students have been using, and teach them a few functional programming techniques with it.
- megaman22 9y agoTotally. A couple books that I've really enjoyed (being somebody that lives in DotNetLand) https://www.manning.com/books/functional-programming-in-c-sharp https://www.manning.com/books/functional-programming-in-c-sh... https://www.manning.com/books/real-world-functional-programming https://www.manning.com/books/real-world-functional-programm...