带参数的活动模式
活动模式只是简单的功能。
与函数类似,你可以定义其他参数:
let (|HasExtension|_|) expected (uri : string) = 
    let result = uri.EndsWith (expected, StringComparison.CurrentCultureIgnoreCase)
    match result with
    | true -> Some true
    | _ -> None
这可以在以这种方式匹配的模式中使用:
    let isXMLFile uri =
        match uri with
        | HasExtension ".xml" _ -> true
        | _ -> false