6 ms·
Interesting, but so many caveats (e.g. writing rough libraries for things like sending emails). I find that Scala offers a better balance by enabling functional
by facorreia 10y ago
Interesting, but so many caveats (e.g. writing rough libraries for things like sending emails). I find that Scala offers a better balance by enabling functional programming while still taking advantage of a huge, mature ecosystem including great libraries and tools.
- continuational 10y agoThere are libraries for sending email. He was talking about a specific cloud API for sending email.
- runeks 10y agoLast time I checked, and I did check recently, I couldn't find a Haskell library that offered an easy way to send email using a Gmail account. Resulting in this homegrown example, which doesn't work: https://github.com/runeksvendsen/restful-payment-channel-server/blob/master/src/PayChanServer/Misc/Email.hs https://github.com/runeksvendsen/restful-payment-channel-ser...
- gbersac 10y agoWorking in scala and enjoying it a lot ! You have a library for every thing and syntax express functional code elegantly. The mix of object and functional programming make all seems a little bit confusing. A problem haskell doesn't have.
- willtim 10y agoIt very much depends on how far you want to take your functional programming. If you want to make heavy use of purity, monads, type classes, tail recursion etc, you will be much better off in Haskell.
- facorreia 10y agoI understand. I don't want to do that, though.
- SatvikBeri 10y agoWe use Scala, and the advantages you mentioned are definitely nice, but one problem is that different Scala libraries aren't as likely to have consistent APIs as with Haskell, since pure FP is only optional in Scala but mandatory in Haskell.
- kahnpro 10y agoThis is especially frustrating when importing Java libraries. Even more so when your project uses Scala's `Future`, but the Java library uses something like RxJava and suddenly you're writing a huge wrapper library and realize you might be better off writing a Scala lib from scratch.
- Joof 10y agoScala loses a lot of the guarantees that Haskell has and I find that Scala programmers often use it in a way that feels more like nicer Java as opposed to functional style. The tooling is amazing though.
- facorreia 10y agoNo argument there. My point is "balance", though. You lose some guarantees, but gain a lot, and the quality of a codebase will always be up to its programmers.
- runeks 10y ago> You lose some guarantees, but gain a lot, and the quality > of a codebase will always be up to its programmers. I started using Haskell because I thought it was cool how it could spread out work over multiple cores. I continue using it because of its guarantees, enabling me to do large refactors and be reasonably confident that the compiler has caught all errors (if I construct my types properly). I would argue that the only true value a compiler has to offer are guarantees. A compiler that is able to do something "most of the time" isn't worth much. So, losing some guarantees may be both crucial and irrelevant, depending on which guarantees we're talking about.
- elcapitan 10y agoSpeaking of the ecosystem, has anybody here experience with Frege? (Haskell for the JVM). Does it feel natural to use existing Java/JVM libraries inside a Haskell dialect?
- harveywi 10y agoI dabbled with it about six months ago. I write most of my software in Scala, but I continue to hit the ceiling and run into places where type inference fails, compiler bugs add friction, or other oddities (22-tuple limit) get in the way. One of my experiments was to see if I could write some portions of my software in Frege, and some in Scala to get the best of both worlds. I think the answer that to that question appears to be yes [1], but I stopped experimenting. I am considering resuming my experiment now that Frege appears to be crystallizing a bit more. The java interop is nice, albeit it imposes discipline (as it should). Since java doesn't care about side effects, most of the values returned from a java function call will be in a Mutable monad. Here [2] is a good walkthrough for how it is done in case you want to try it out. [1] https://groups.google.com/d/topic/frege-programming-language/vy_fR3bNYrA/discussion https://groups.google.com/d/topic/frege-programming-language... [2] http://mmhelloworld.github.io/blog/2013/07/10/frege-hello-java/ http://mmhelloworld.github.io/blog/2013/07/10/frege-hello-ja...
- premium-concern 10y agoDo you have some examples for "type inference fails"? Do you have some examples for "compiler bug"?
- harveywi 10y agoHere is a quick shortlist of some type inference issues (some bugs, some enhancements, and some fundamental limitations of the language design) that I run into pretty much daily: 1. (Search for "asInstanceOf"): http://typelevel.org/cats/tut/freemonad.html http://typelevel.org/cats/tut/freemonad.html 2. (Finally fixed and will hopefully be released soon - yay!): https://issues.scala-lang.org/browse/SI-2712 https://issues.scala-lang.org/browse/SI-2712 3. https://twitter.com/extempore2/status/430456002392391681 https://twitter.com/extempore2/status/430456002392391681 4. http://pchiusano.blogspot.com/2011/05/making-most-of-scalas-extremely-limited.html http://pchiusano.blogspot.com/2011/05/making-most-of-scalas-... 5. (Anecdotal): Various pattern matching peculiarities. Compiler bugs: As long as I write code on the happy path and steer clear of scalaz/shapeless/cats, the compiler is pretty well-behaved and I can go months without getting a compiler crash. However, when I add those in and start writing pure functional code with complicated types that hits the intersections of various features (e.g., GADTs, package objects, implicits), I get a few crashes per week related to known bugs. It works pretty well, and I am not trying to complain too much about all the mileage I get out of Scala and the excellent tooling! Just trying to get the most out of it.
- kahnpro 10y agoNormally for e-mails, if you're sending out any large volume, I always use a cloud service that has already solved all the problems of sending e-mail without getting blacklisted, and in this case it's simply using something like the fantastic Servant library to send HTTP requests.