4
我想在haskell中複製UNIX程序wc。爲了更方便我已經創建了一個類型:Haskell「顯示應用於太多類型參數」
data WCResult = WCResult {
wordCount :: Int,
fileName :: String
} --deriving (Show)
instance Show (WCResult x y) where
show (WCResult x y) = show x ++ " " ++ y
當我嘗試和運行這個程序,我得到
wc.hs:9:15:
`WCResult' is applied to too many type arguments
In the instance declaration for `Show (WCResult x y)'
有誰知道爲什麼嗎?