5 ms·
Edit: Before Haskell, I used Common Lisp, Python, and Clojure. I was impatient, generally more interested in hacking than math, and was happy using untyped pro
by coolsunglasses 13y ago
Edit:
Before Haskell, I used Common Lisp, Python, and Clojure. I was impatient, generally more interested in hacking than math, and was happy using untyped programming languages.
Haskell changes the equation, it (alone, for now) provides even better leverage and expressiveness than untyped languages like Clojure, Python, or Ruby. Further, it does so in a way that is more powerful and reliable because you have the leverage of the type system behind you.
Learning to think about code in terms of types is a transformative experience.
Types is where the future is headed.
I've been getting people started with Haskell for the last ~3-4 months. It's not that hard to learn at all if you use proper learning material and do the exercises.
Don't waste any time, just learn Haskell and find out for yourself.
My guide for learning Haskell:
https://gist.github.com/bitemyapp/8739525 https://gist.github.com/bitemyapp/8739525
- SamReidHughes 13y agoHave you ever used any other statically typed languages? How much of Haskell's benefit do you think it provides that simply having static typing doesn't provide?
- dllthomas 13y agoWhen you say "other statically typed languages" do you mean ML and Agda, or Java and C?
- SamReidHughes 13y agoAny. (Maybe not something as simple C or Go, and nothing like Agda, but something like ML or Java or C++.) There is something wrong with the grandparent post, because it's not making an argument that distinguishes Haskell from other statically typed languages.
- dllthomas 13y agoOk, well, for what it's worth I think that Haskell typing is equivalent in strength to ML. It's absolutely stronger than pre-generics Java; possibly isomorphic now. Roughly isomorphic to C++ with templates. In Haskell and ML, inference and clean syntax for type constructors makes it substantially easier to apply that power legibly (and structural pattern matching is a nice bonus). Monads let you extend that power to statements instead of just expressions.
- ibotty 13y agono, haskell (ghc) has many extensions that extend hindley-milner by a great degree.
- dllthomas 13y agoYes, I wasn't trying to make any strong claims of theoretical equivalence. In my experience with Haskell and OCaml and much more limited with SML, I've not found myself wanting to express a lot in those languages that I'd have been able to in Haskell, types-wise. Remember that the original question was "How much of Haskell's benefit do you think it provides that simply having static typing doesn't provide?" I should perhaps have been clearer.
- quchen 13y ago- Haskell types often guide development: the error message ("type mismatch: expected blabla") gives you strong hints about what sort of error you've made. The magnitude of this one is hard to convey by merely writing/reading about it though. - Easy wrapping to create new types: Ever switched the arguments of `mv` in your terminal (strings)? Read the User ID as an account balance (ints)? You can distinguish these statically, and it's easy to do so. (You can of course write a wrapper class in C++ around Int as well a la "class OtherInt { int value; int get(); set(int i) }", but how often do you do that? - No IO in a type? It cannot do IO. Has "Monad" in the type? It can do Monadic stuff, but no operations specific to any Monad instance (such as Maybe, IO, ...). - Types are forced documentation. Don't get me wrong, no documentation is as awful in Haskell as it is anywhere else. However, even without any ordinary comment, a type can give away a lot of what a function does; maybe even more importantly, it tells you what it cannot do. If you see something of type `(a -> b) -> (a -> a)`, you know that the first argument cannot possibly be used - it has to be a dummy parameter.
- mushly 13y agoHow do you do documentation in Haskell? For Python and Clojure, there's docstrings. For Java there's Javadoc. For Haskell, there doesn't seem to be any well-established documentation practices. This is of course not counting the occasional comment explaining why/how you're doing something convoluted.
- dllthomas 13y agoThere is haddock and literate haskell. Types also serve as some documentation.
- quchen 13y ago> For Haskell, there doesn't seem to be any well-established documentation practices. Oh yes but there is! It's called Haddock. It's widely (and probably exclusively) used. The entirety of the documetation you can find on Hackage [1] (example: [2]) is generated using it. The user guide can be found here [3]. [1]: http://hackage.haskell.org/ http://hackage.haskell.org/ [2]: http://hackage.haskell.org/package/pipes-4.1.0/docs/Pipes-Prelude.html http://hackage.haskell.org/package/pipes-4.1.0/docs/Pipes-Pr... [3]: http://www.haskell.org/haddock/doc/html/ http://www.haskell.org/haddock/doc/html/
- coolsunglasses 13y agoI have used other statically typed languages (I used to do C# .NET for a living), but Haskell was the first time I felt like I was getting my money's worth so to speak.