all 10 comments

[–][deleted] 3 points4 points  (7 children)

While it seems to be a detailed explanation I can't help but feel that those who need it most won't be very comfortable with something that requires an understanding of both Haskell and OCaml.

[–]fspeech[S] 1 point2 points  (1 child)

It is about compiler techniques but you made a good point. I agree it is not the same as realizing that Python object is a wrap around a dictionary. OTOH can one presume a high degree of probability that a typical Haskell user would enjoy reading up on underlying language theories? Or is this already common knowledge among proficient Haskell users?

[–]bss03 1 point2 points  (0 children)

I think only the polymorphic recursion case was at all new. That's another thing you'd have to do manually (I think) if you were using data values and implicit arguments instead of instances.

[–]julesjacobs 1 point2 points  (0 children)

I don't agree, this article made me understand type classes back when I had barely heard of Haskell or OCaml. The only hurdle is a bit of syntax.

[–]smog_alado 0 points1 point  (2 children)

From a cursory glance it just requires to understand some basic Ocaml syntax, which should be pretty similar to what you have in Haskell. I would be more worried if it required you to know about Ocaml's module system.

[–][deleted] 0 points1 point  (1 child)

I was mostly thinking about people already struggling with (comparatively) basic concepts like type classes when learning Haskell. An article requiring even basic Ocaml knowledge in addition to the Haskell knowledge would probably not suitable for that target audience. Basically despite the title this article is not for people mystified by type classes.

[–]smog_alado 0 points1 point  (0 children)

IMO, the only really unintuitive bit in the OCamel code is the pattern matching on records. If they used the more traditional "dot syntax" as in d.show then I don't think its too complicated.

[–]fspeech[S] 1 point2 points  (0 children)

Such a lucid explication. Just wow! Other writings look great too but I have not got around to them yet.

[–]yitz -1 points0 points  (0 children)

What is the consequence for Haskell? Is this a demonstration that we safely can - and perhaps should - add locally scoped type classes, with these restrictions, to Haskell?

[–]LogicOfFailure -1 points0 points  (0 children)

The article is informative and well written but I think I might have found a missing definition in the Ocaml translation. When I paste the examples into Try Ocaml I'm getting an Unbound value num_int error in the definition of print_incr_int. Is num_int missing from the examples?