1
假设我有一个数据类型,如:SML打压有意非排他性的模式匹配警告
datatype location = Safe of string | Dangerous of string * int;
而在这个假设的例子中,我想写的是仅会传递一个Safe str
,从来没有一个Dangerous(str, num)
功能:
fun send_kids (Safe address) = ...
有什么办法可以压制警告吗?告诉SML我知道这是非穷举的?
stdIn:1.6-1.29 Warning: match nonexhaustive
Safe s => ...