News for hackers. Stuff that matters.
Re:Show HN: Learn Functional Programming Using Haskell by nv-vn on Wednesday August 03, 2016 @03:07AM (#12216175)
You can't parametrize type classes over one another in the same way. In practice, this often makes ML style modules much more expressive: for example, I can have a Hashable type class with one implementation per type that is used by a HashSet data type or module, but with MLs there could be a number of modules for the same type implementing the hash function, which can be used to construct the set. This also means things like Monoids or Semigroups greatly benefit, since now you can easily have more than just (+) for ints, for example. You can even use this to derive operations like folds from your base module where you'd never have to apply the arguments to a folder; instead you could do Sum.fold or Product.fold based on the different base modules.
Re:Show HN: Learn Functional Programming Using Haskell by wyager on Wednesday August 03, 2016 @02:08PM (#12220113)
You can do this in Haskell as well, it's just clunkier since you usually end up needing some combo of MultiParamTypeClasses and plumbing around extra types.

The ML approach is better for this use case, but the Haskell approach can do the same with a bit more verbosity.

Re:Show HN: Learn Functional Programming Using Haskell by nv-vn on Thursday August 04, 2016 @04:10PM (#12228104)
Of course, but at that point one could throw in OCaml extensions (modular implicits + HKTs) to provide the Haskell functionality to OCaml.