我想将 String 作为构造函数的一部分:
> data Car = Wheel | Trunk | String deriving (Show)
> test::Car->Car->Car
> test Wheel Wheel = "Wheel"
> test _ _ = ""
它说:无法将 Car 与 [Char] 匹配
如果我将构造函数更改为
> data Car = Wheel | Trunk | [Char] deriving (Show)
它说:数据/新类型声明中的构造函数错误:[Char]
那么如何创建一个构造函数也是字符串的数据类型呢?