yawaramin / fsharp-typeclasses

24 stars 0 forks source link

Another approach #1

Closed gusty closed 7 years ago

gusty commented 7 years ago

Hi @yawaramin

Interesting to see the explicit dictionary approach. You mentioned that the 'The state of the art approach' is the one used by Higher, but I would like to point you another approach which is used by a production-code library: F#+ and I found it very easy to use. It consists in abusing STRP.

So far many common FP abstraction were represented and the user doesn't have to worry about passing a dictionary or injecting values and having run-time overhead, just call the generic function (as in Haskell) and the compiler will take care.

yawaramin commented 7 years ago

Hi! Yeah SRTP are definitely a powerful tool. I think I realised how extensible they are when I saw https://fpish.net/topic/None/59738#comment-74165 .

So for F# ad-hoc polymorphism I agree SRTP is probably the state of the art. I will try to port over my JSON example project to that approach and see how it goes.