我開始Haskell ...我嘗試以兩種不同的方式編寫以下平凡函數,讓Haskell決定類型,並且類型系統在每個函數中執行一些不同的操作案件。這種行爲的解釋是什麼?將函數轉換爲無點樣式改變其類型
Prelude> let f x = 2 * x
Prelude> let g = (2*)
Prelude> :info f
f :: Num a => a -> a -- Defined at <interactive>:1:5
Prelude> :info g
g :: Integer -> Integer -- Defined at <interactive>:1:5
謝謝!
可能重複(HTTP:/ /stackoverflow.com/questions/32496864/what-is-the-monomorphism-restriction) – Bakuriu 2015-09-10 08:34:53