假设我定义了自己的数据类型
data MyData = A arg| B arg2| C arg3
我如何编写一个函数(例如isMyDataType:)来检查给定的参数是否是特定类型中的一个MyData并连续返回一个布尔值(True或False),例如输入Ghci: isMyDataType B返回True并isMyDataType Int返回False.
isMyDataType
MyData
isMyDataType B
isMyDataType Int
haskell types typechecking
haskell ×1
typechecking ×1
types ×1