I am testing examples in the Haskell Tutorial for C programmers (part 2) , and I have some problems with this ...
showPet :: Maybe (String, Int, String) -> String
showPet Nothing = "none"
showPet (Just (name, age, species)) = "a " ++ species ++ " named " ++ name ++ ", aged " ++ (show age)
While it compiles, calling it with
showPet ("cat",5,"felix")
leads to
<interactive>:131:9:
Couldn't match expected type `Maybe (String, Int, String)'
with actual type `([Char], t0, [Char])'
In the first argument of `showPet', namely `("cat", 5, "felix")'
In the expression: showPet ("cat", 5, "felix")
In an equation for `it': it = showPet ("cat", 5, "felix")
Am I calling this incorrectly or is this a change in Haskell that makes it necessary for the change (I found several)?
source
share