Skip to content

Instantly share code, notes, and snippets.

@Mark-Broadhurst
Last active August 9, 2016 15:15
Show Gist options
  • Save Mark-Broadhurst/bc45f76ed338948513083b062519a7f7 to your computer and use it in GitHub Desktop.
Save Mark-Broadhurst/bc45f76ed338948513083b062519a7f7 to your computer and use it in GitHub Desktop.
FParsec Guid Parser
#r "../packages/FParsec.1.0.2/lib/net40-client/FParsecCS.dll"
#r "../packages/FParsec.1.0.2/lib/net40-client/FParsec.dll"
open FParsec
open System
let test p str =
match run p str with
| Success(result, _, _) -> printfn "Success: %A" result
| Failure(errorMsg, _, _) -> printfn "Failure: %s" errorMsg
let pGuid = many1Chars (hex <|> pchar '-') |>> fun a -> Guid.Parse a
test pGuid "30CA5880-9F26-447A-B835-8A8812B340EE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment