Does Haskell have return type overloading?

后端 未结 5 879
囚心锁ツ
囚心锁ツ 2020-12-05 03:09

Based on what I\'ve read about Haskell, and the experimentation I\'ve done with GHC, it seems like Haskell has return type overloading (aka ad hoc polymorphism). One example

5条回答
  •  悲哀的现实
    2020-12-05 04:00

    It has return type overloading. For a good example see the Read function. It has the type Read a => String -> a. It can read and return anything that implements the read type class.

提交回复
热议问题