Explain Type Classes in Haskell

前端 未结 6 1452
南旧
南旧 2020-12-28 10:04

I am a C++ / Java programmer and the main paradigm I happen to use in everyday programming is OOP. In some thread I read a comment that Type classes are more intuitive in na

6条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-28 10:51

    A type class can be compared to the concept of 'implementing' an interface. If some data type in Haskell implements the "Show" interface, it can be used with all functions that expect a "Show" object.

提交回复
热议问题