News for hackers. Stuff that matters.
Re:An OCaml manifesto – Problems and what's needed for wides... by pauldirac137 on Thursday March 31, 2016 @04:37PM (#11400400)
Modules are strictly more powerful than Haskell type classes (at least, more powerful than naive type classes; there are so many extensions that I'm not sure that is still the case). Modular implicits are described here: http://arxiv.org/pdf/1512.01895.pdf. The main problem with modules as typeclasses is that it's pretty painful to use in practice, and modular implicits fix that, giving a solution quite reminiscent of Haskell type classes. I don't know Scala implicits well enough to comment, but the authors feel their version avoids most of the problems in Scala's implicits (they jokingly refer to it as "a more explicit kind of implicit").
Re:An OCaml manifesto – Problems and what's needed for wides... by lomnakkus on Friday April 01, 2016 @02:56AM (#11403154)
AFAIUI modular implicits don't give you global uniqueness. While this can be "worked around" in some cases[0], it's not really possible in the general case, and global uniqueness is pretty essential for sanity when writing higher-level code[1].

[0] The paper gives set-union as an example.

[1] https://www.youtube.com/watch?v=hIZxTQP1ifo . (Sorry for throwing video at you -- there's probably a write-up somewhere, but I'm in a bit of a rush, and this was the thing that came to mind.)

Re:An OCaml manifesto – Problems and what's needed for wides... by airless_bar on Friday April 01, 2016 @06:09AM (#11403826)
> [1] https://www.youtube.com/watch?v=hIZxTQP1ifo

Now we just need a Haskell compiler which actually bothers to provide the "pretty essential for sanity" for global uniqueness. Currently, I count zero compilers in common use which do.

Re:An OCaml manifesto – Problems and what's needed for wides... by lomnakkus on Friday April 01, 2016 @12:22PM (#11406022)
Not sure what you mean. Could you elaborate?
Re:An OCaml manifesto – Problems and what's needed for wides... by airless_bar on Friday April 01, 2016 @01:41PM (#11406802)
GHC gives you none of the guarantees Kmett keeps boasting about.
Re:An OCaml manifesto – Problems and what's needed for wides... by lomnakkus on Friday April 01, 2016 @02:35PM (#11407321)
How so?

(EDIT: Just to forestall the inevitable: Yes, there are some weird and dangerous extensions you can enable, but mostly it's pretty clear that they're dangerous. It doesn't seem to be a problem in practice.)

Re:An OCaml manifesto – Problems and what's needed for wides... by airless_bar on Saturday April 02, 2016 @05:08AM (#11410837)
> How so?

Because they never bothered to actually implement the checks to guarantee global uniqueness in GHC?

> (EDIT: Just to forestall the inevitable: Yes, there are some weird and dangerous extensions you can enable, but mostly it's pretty clear that they're dangerous. It doesn't seem to be a problem in practice.)

No weird and dangerous extensions in use. Vanilla Haskell.

Re:An OCaml manifesto – Problems and what's needed for wides... by tome on Saturday April 02, 2016 @12:55PM (#11412204)
> Because they never bothered to actually implement the checks to guarantee global uniqueness in GHC?

Sure they did. Orphan instances are detected by the compiler.

Re:An OCaml manifesto – Problems and what's needed for wides... by airless_cotton on Saturday April 02, 2016 @03:00PM (#11412794)
(Sorry, forgot password to my old account.)

Orphan warnings tell you that you defined an instance in the wrong place.

Things you don't receive warnings for:

  - Defining the same instance twice.
  - Having code which uses both instances.
Those two should be hard compiler errors, because they break data structures at runtime and make code behave incorrectly.

Sorry, orphan warnings are multiple magnitudes of escalation levels away from what should happen and are focused on something different (code hygiene vs. THIS-CODE-IS-WRONG-AND-BROKEN-AND-WILL-CORRUPT-SHIT-AT-RUNTIME-I-WILL-FAIL-TO-COMPILE-THIS).

Re:An OCaml manifesto – Problems and what's needed for wides... by tome on Saturday April 02, 2016 @04:49PM (#11413363)
No, forbidding orphan instances is exactly what you need so that both 1) duplicate instances are never defined, and 2) instances written by separate parties never conflict. If you think that should be an error rather than a warning then fine, but in either case code without orphan instances never has breakage due to instance clashes. It's the correct way to solve the problem.
Re:An OCaml manifesto – Problems and what's needed for wides... by airless_cotton on Saturday April 02, 2016 @06:50PM (#11413937)
I wonder why you feel the need to comment if you haven't understood the issue.
Re:An OCaml manifesto – Problems and what's needed for wides... by dllthomas on Sunday April 03, 2016 @03:01AM (#11415231)
This is needlessly rude.

I believe I've understood the issue, but if I've misunderstood then I feel extra need to comment, that my misunderstanding might be clarified.

From my first reading of what you'd written, tome seemed spot on.

On careful re-examination (after reading this comment), I think when you said "Things you don't receive warnings for:" you did not mean to say that you can write that code and receive no warnings (a reasonable interpretation), but that the warnings would not read as directed at the points you raise (also a reasonable interpretation) - which (you note) are substantially more important than "this is generally a good idea."

Re:An OCaml manifesto – Problems and what's needed for wides... by tome on Sunday April 03, 2016 @03:24AM (#11415277)
Firstly, one tends to believe that one understands before one comments even if one actually doesn't, so admonishment to understand before commenting will typically be redundant. Secondly, if one doesn't understand, blame can often lie on both sides of the conversation.

I claim that if you never have orphan instance warnings then your code has "the guarantees Kmett keeps boasting about". In particular you can never "define the same instance twice", and this of course implies that you cannot "have code which uses both instances".

What exactly is your complaint and why does my claim not address it?