Haskell why does “Num x” require “Show x”?

后端 未结 4 1635
北荒
北荒 2020-12-20 13:00

Recently I took a look at Haskell, using LYAH.

I was messing around with type classes and wrote this quick test function:

foo :: (Num x) => x ->         


        
4条回答
  •  伪装坚强ぢ
    2020-12-20 13:32

    Shouldn't you write:

    (Num x) => x -> String
    

    Instead of

    (Num x) x -> String
    

    And as far as I know this inheritance is at least outdated.

提交回复
热议问题