3 ms·
I haven't used Oz at all, and don't feel like comparing Lisps to Scala right now, but I would agree with you that functional code that I've seen in Haskell look
by sreque 15y ago
I haven't used Oz at all, and don't feel like comparing Lisps to Scala right now, but I would agree with you that functional code that I've seen in Haskell looks a lot cleaner than it does in Scala. Haskell is, of course, in many ways a narrower language in scope. It doesn't support subtyping or an imperative style, and doesn't have to deal with the constraints of running on the JVM or Java interoperation. I would say that, in general, the Haskell community are much less interested in Haskell becoming a widespread or pragmatic language.
I feel like the compromises Scala makes are valid. I guess in the end though if you feel like Scala is unreadable then it is not the language for you. Since Scala is something I believe strongly in, I wish there were a way I could help make it more readable for you! As someone who knows both Perl and Scala well, I feel like there is a whole world of difference between the two.
- Locke1689 15y agoIt doesn't support subtyping or an imperative style I would argue that monads are the ultimate imperative style. I would also agree that Haskell users have very little interest in it becoming mainstream. My main gripe with Scala (in which another developer in my compilers class used it, not me), was that when reading his code I saw a lot of "magic." I'm not sure if that was better or worse, just... different.
- sreque 15y agoThere are few things that seemed more magical to me at first glance than Haskell's point-free style! :) I would explain the difference between Perl magic and Scala magic as being that Scala magic reduces down to a relatively few simple but flexible rules, whereas Perl magic reduces to a bunch of edge cases and special rules that lack any form of cohesion. Once you learn these rules, reading Scala code becomes very manageable. I found the Haskell code I saw to be clearer because it's type system allows one to omit types much more frequently, its indentation and function declaration style let you avoid a lot of curly braces and parenthesis, it's type class system involved less syntactic ceremony than Scala's implicits, point-free style allows one to omit Scala's underscores, and so on. All of these things added up so that in the end, I felt like Haskell just looked a lot nicer, much more concise and like the math it was trying to express. I'm sure some of the authors of Scalaz could do a much better job than me explaining Haskell's advantages over Scala when writing functional code, since I am by no means a Haskell expert.
- chromatic 15y agoPerl magic reduces to a bunch of edge cases and special rules that lack any form of cohesion. I can think of two general philosophical premises which underlie most of those special rules in Perl: implicit variables and context. Most tutorials and books explain them poorly, which is why so many people never understand them.
- Rusky 15y agoMonads are definitely not the ultimate imperative style. I love Haskell, but once you use too much IO or Reader/Writer or anything like that everything gets messy and ugly. Imperative style really benefits from loops and also several design patterns that really don't work or exist in monads.
- deleted 15y ago[deleted]