Last active
August 9, 2016 15:15
-
-
Save Mark-Broadhurst/bc45f76ed338948513083b062519a7f7 to your computer and use it in GitHub Desktop.
FParsec Guid Parser
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
#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