Haskell は初めてで、リストを受け取って bool を返す関数を書こうとしています。
True
入力リストが'a'
only で構成されるリストである場合は返され、False
そうでない場合は返されます。
これは私の最善の推測です:
f :: [a] -> Bool
f ('a':[]) = True
f (x:xs) = False
これはコンパイルに失敗し、次を返します。
Couldn't match type `a' with `Char'
`a' is a rigid type variable bound by
the type signature for f :: [a] -> Bool at charf.hs:6:1
In the pattern: 'b'
In the pattern: 'b' : []
In an equation for `f': f ('b' : []) = True
私のロジックのエラーは何ですか?