I am trying to replicate the UNIX program wc in haskell. To make this easier I have created a type:
data WCResult = WCResult {
wordCount :: Int,
fileName :: String
} --deriving (Show)
instance Show (WCResult x y) where
show (WCResult x y) = show x ++ " " ++ y
When I try and run this program I get
wc.hs:9:15:
`WCResult' is applied to too many type arguments
In the instance declaration for `Show (WCResult x y)'
Does anyone know why?
The type
WCResultdoesn’t take any parameters — you’re confusing the type constructor with the data constructor, which does take arguments: