Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save AndreasHassing/13791250d1d6b6a70b80e0f76ebf7255 to your computer and use it in GitHub Desktop.

Select an option

Save AndreasHassing/13791250d1d6b6a70b80e0f76ebf7255 to your computer and use it in GitHub Desktop.
let (|UpperCase|) (str: string) = str.ToUpper()
// This blows my mind!
// thanks: https://youtu.be/yE88l29NOZw?t=151
let usedInAFunctionSignature (UpperCase(upper)) =
printfn "%s" upper
let usedLikeAMethod str =
let upper = (|UpperCase|) str
printfn "%s" upper
@AndreasHassing
Copy link
Author

Thanks @7sharp9! :)

@AndreasHassing
Copy link
Author

Immensely useful to be able to use single case active pattern like this in the method signature - sort of like a function signature level converter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment