考虑以下函数:
let private actionPixel(pixelColour:Color) =
match (pixelColour.A, pixelColour.R, pixelColour.G, pixelColour.B) with
| (0uy, _, _, _) -> transparent
| (alpha, red, green, blue) when red = blue && red = green && red <> 255uy ->
Color.FromArgb(calculateAlpha (int alpha) (int red), 0, 0, 0)
| _ -> pixelColour
我想做的是替换| (alpha, red, green, blue) when red = blue && red = green && red <> 255uy ->
为| (alpha, value, value, value) when value <> 255uy ->
. 如果我这样做,我会得到一个'value' is bound twice in this pattern
错误。
有没有办法重写该行以简化满足编译器的防护?