Earlier quoted context omitted.
I don't know OCaml very well, but I do know that without laziness, it does not support as much high-level/reusability[1]. Also, it lacks much of the mind-expanding stuff in Haskell (The class hierarchy explained by the Typeclassopedia). AFAIK, GHC had surpassed OCaml's compilers' performance, concurrency support, etc. Compiler rewrite rules are also a very nice feature that other languages cannot immitate due to lack…
Your're showing your ignorance. OCaml has full support for laziness. It's just default strict with optional laziness via a keyword ( http://caml.inria.fr/pub/docs/manual-ocaml/libref/Lazy.html ), rather than the opposite. The only thing Caml lacks that haskell has is typeclasses, so doing non-integer math is ugly, and non-int/float math is REALLY ugly, like something out java or something, since there is _no_ operato…
When Haskell Is Not faster than C
201–210 of 227 posts
Re: When Haskell Is Not faster than C
#202Earlier quoted context omitted.
OCaml isn't purely functional, so it misses some of the most important benefits of Haskell. It's also not entirely honest (in the fact that you can do things that the type system doesn't tell you about.)
With unsafePerformIO, Haskell is also not "entirely honest"...
Re: When Haskell Is Not faster than C
#203Earlier quoted context omitted.
strangely enough, I think one of the interesting features (type classes) only ended up reappearing in Go with its interfaces (granted, only in a very limited fashion).
I think one of the most important features of typeclasses is the ability to be polymorphic on just the return type of an expression. For example, there is a typeclass called Read which comes with a function called read: read :: Read r => String -> r That is, you get a function from a String to whatever type is in the typeclass. It's the opposite of toString. This is also used in a whole bunch of other contexts like n…
Re: When Haskell Is Not faster than C
#204Earlier quoted context omitted.
The point is that you use a single function for any type. So in Python you'd have to do int() or float() or customType()... In Haskell, all of these would be just `read'. The type system can figure out which instance to use for you, without having to specify it. Moreover, it's also trivial to write a function that works on any readable type, something hard (although not entirely impossible) to do in Python. This make…
That does make more sense, and I appreciate the more thorough explanation. It seems a bit ironic though, that Python makes you more specific and certain about the output type than Haskell!
Re: When Haskell Is Not faster than C
#205I still wonder to this day why Haskell programmers want their language to be loved so much. At times it feels like that kid at the playground that spends half his time telling everyone how he's the best thing since sliced bread and cries himself to sleep at night wondering why no one will play with him and his monads. Don't get me wrong, Haskell looks like a great language with obvious qualities and I don't knock any…
"You want to play? Great! The rules? Perhaps it's easiest if you understand category theory first..."
However, you can get very very far in Haskell without ever doing or touching any CT.
Re: When Haskell Is Not faster than C
#206Earlier quoted context omitted.
I think one of the most important features of typeclasses is the ability to be polymorphic on just the return type of an expression. For example, there is a typeclass called Read which comes with a function called read: read :: Read r => String -> r That is, you get a function from a String to whatever type is in the typeclass. It's the opposite of toString. This is also used in a whole bunch of other contexts like n…
Aren't Rust "type-classes" also limited and use single-dispatch?
Re: When Haskell Is Not faster than C
#207Earlier quoted context omitted.
I don't know OCaml very well, but I do know that without laziness, it does not support as much high-level/reusability[1]. Also, it lacks much of the mind-expanding stuff in Haskell (The class hierarchy explained by the Typeclassopedia). AFAIK, GHC had surpassed OCaml's compilers' performance, concurrency support, etc. Compiler rewrite rules are also a very nice feature that other languages cannot immitate due to lack…
Your're showing your ignorance. OCaml has full support for laziness. It's just default strict with optional laziness via a keyword ( http://caml.inria.fr/pub/docs/manual-ocaml/libref/Lazy.html ), rather than the opposite. The only thing Caml lacks that haskell has is typeclasses, so doing non-integer math is ugly, and non-int/float math is REALLY ugly, like something out java or something, since there is _no_ operato…
Re: When Haskell Is Not faster than C
#208Earlier quoted context omitted.
I think the sytnax of Erlang is much more elegant, because it was build around the fundamental idea of pattern matching as a core feature of the language. When you have a few good ideas put together, you could get an elegant solution. When you just stuff everything inside (like Clojure) or went to extremes (like Haskell) all you got is just a mess. Erlang syntax, however, is noisy due to all those punctuation, but it…
I'm not sure I follow you. Is the pattern-matching in Haskell somehow not 'core' enough? Both qsort examples linked in this thread use pattern matching.
I honestly can't see why should I use Haskell (except for being so clever) when I have Erlang, or at least one real advantage.
Re: When Haskell Is Not faster than C
#209Earlier quoted context omitted.
as a rubyist who has dabbled a bit in haskell, i think the two camps are exactly the same in terms of proselytising. it's just frustrating to see people using "less-capable" languages and imagining how much happier/more productive/safer they'd be if they only adopted yours.
The difference there is that Haskell actually does offer some functionality and concepts that aren't really present in most other programming languages. Ruby, on the other hand, is pretty unremarkable. It doesn't really offer anything beyond what older languages like Perl and Python, for example, offer.
Re: When Haskell Is Not faster than C
#210Earlier quoted context omitted.
I'm not sure I follow you. Is the pattern-matching in Haskell somehow not 'core' enough? Both qsort examples linked in this thread use pattern matching.
All I'm trying to say that Erlang syntax is much more intuitive and readable, being derived from Prolog. I honestly can't see why should I use Haskell (except for being so clever ) when I have Erlang, or at least one real advantage.
map f (h:t) = f h:map f t
map f [] = []
member x (h:t) = x == h || member x t
member _ [] = False
I think the only difference is that you can't match for equality directly in the pattern.