
Hi, Sorry for the spam. I am new to Haskell. I want to define my own typeclass which can convert from my own types like MyBool, MyInt, and MyString to according Haskell types. Here is my code: module Conversion where import qualified Prelude class Conversion a where conversion :: a -> b data MyBool = MyTrue | MyFalse instance Conversion MyBool where conversion MyTrue = Prelude.True conversion MyFalse =Prelude.False Here is the error message: Couldn't match expected type `b' with actual type `Prelude.Bool' `b' is a rigid type variable bound by the type signature for conversion :: MyBool -> b at Conversion.hs:11:5 Does anyone know what's wrong with my code, and how to fix it? Any hints will be appreciated !! Best, --Ke