Created
August 16, 2022 14:41
-
-
Save alex-ilin/abdc9a81a4428c7efdd9c2d2a7407d5d to your computer and use it in GitHub Desktop.
F# Warning FS0049 when catching an exception class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type SitAction = { Rest: int } | |
type StandAction = { Rest: int } | |
type Action = | |
| Stand of StandAction | |
| Sit of SitAction | |
let lastStandIndex (x: Action list) : int option = | |
try | |
x |> List.tryFindIndex (function | |
| Stand _ -> true | |
| _ -> false) | |
with | |
| KeyNotFoundException -> None | |
// Warning FS0049: Uppercase variable identifiers should not generally be used in patterns, | |
// and may indicate a missing open declaration or a misspelt pattern name. | |
// How do I avoid this warning without suppressing it? | |
// I tried using the full name System.Collections.Generic.KeyNotFoundException, but that would not compile. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Perfect, thank you!
(I have left out the
as ex
part, since I'm not going to use the identifier.)