module People where
data Male = Man | Woman
class Human where
Male2 :: Male
instance Human Male where
Who :: Male -> String
Who = if Male == Man
then "Man"
else "Woman
GHCI 请抛出此错误
People.hs:6:5: error:
Invalid type signature: Male2 :: ...
Should be of form <variable> :: <type>
Failed, modules loaded: none.
所以我不明白出了什么问题。我对这门语言的了解并不出名,但我仍然无法想象我会在哪里犯错)
原来用小写字母写值不是约定,而是语言要求)但是现在想知道自己的类型怎么写比较...