3 ms·
If we're 'fixing' ML, type classes are a huge fix for the kludgy-yet-precise 2 + 3 => 5, 2.0 +. 3.0 => 5.0 .
by arh68 13y ago
If we're 'fixing' ML, type classes are a huge fix for the kludgy-yet-precise 2 + 3 => 5, 2.0 +. 3.0 => 5.0 .
- riffraff 13y agoIsn't "+." an ocaml thing rather than ML in general? I think SML had overloaded numeric operators, though I think that's a special case (i.e. type classes are still better)
- arh68 13y agoYep, you're right :). I opened the Standard ML book, and there on p75 they list * :: num * num -> num. Then at the bottom they say each function declared as such really has two definitions, one with num replaced by int and one with num replaced by real. So yes, +. is just an ocaml thing. Not sure about caml.