Hacker News new | past | comments | ask | show | jobs | submit login

Having spent 10 months working in Swift, this is probably the last thing on earth I want to see right now.

Pretty much every part of the entire toolchain has been a pain, from Xcode being Xcode, to compiler bugs and crashes, crappy package management and bad language design.

Having built servers in Java/C#/Scala/Haskell, I'd pick Haskell over those options and Swift every single time.




What is it about Haskell? I'm currently heavily invested in Rust and have very briefly looked at Haskell, but find it to have some oddities that I can wrap my head around.


So I only know a minimal amount about Rust, so if there's things which are the same there, then I'll probably be blindly ignorant about them.

First thing is that with the build tool Stack and now with recent versions of Cabal the process of having a nice repeatable consistent build is pretty smooth. I also used a tool called ghcid to get sub-second feedback on my changes as I make them.

Haskell has started at the opposite end of the spectrum to most programming languages, as in "How do I represent functions mathematically?" rather than "How do I flip this bit in the accumulator register?". Which is probably somewhat to your point about oddities, for me coming from an OOP background there was a huge mental shift that had to happen to "get it". I've found that things tend to just slot together so much more easily as a result. Curried functions for example was a revelation for me, being able to pass (== 10) to a list filter isn't some special case syntactic sugar it just falls out by default.

Now much more people have gotten to grips with it there are amazing things like the servant libraries which allow you to define a HTTP service(url, query params, request method, etc.) with a type. You can implement a service against that type and get all the appropriate checks, which is great. But then the incredible part is that you can get it to create functions for each endpoint in that service totally automatically at compile time: https://hackage.haskell.org/package/servant-client#readme


Minor nitpick: "(==) 0" wouldn't be syntactic sugar, but "(== 0)" is. But I agree it's a very natural consequence of the way the language is designed.


I'm not sure I understand, is there some special casing going on with "(== 10)"? As I'm admittedly not aware of it.


Not anything major. It's just syntactic sugar for "\x -> x == 10".


How is it syntactic sugar? It's just applying "10" to the first parameter of "==".


Without parentheses, == is infix. (== 10) is an "operator section", and applies 10 to the second parameter of ==. (10 ==) would be the first parameter.


Ah yes, very true.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: