多分値をCharに変換しようとしています。次のエラーが発生します。最善を尽くしても、これを修正する方法がわかりません。
convertmaybe.hs:18:22:
No instance for (ToChar a)
arising from a use of `toChar'
In the expression: toChar a
In an equation for `showMaybe': showMaybe (Just a) = toChar a
Failed, modules loaded: none.
これはコードです:
class ToChar a where
toChar :: a -> Char
instance ToChar Char where
toChar = id
instance ToChar Int where
toChar = head . show
showMaybe :: Maybe a -> Char
showMaybe Nothing = ' '
showMaybe (Just a) = toChar a
私はここで何が間違っているのですか?