Quantcast
Channel: User Tarmil - Stack Overflow
Viewing all articles
Browse latest Browse all 38

Answer by Tarmil for Moving FParsec code to an F# module does not work

$
0
0

As explained by @Gus in the comments, the problem is that parsers have a second type parameter for user data, that was disambiguated by the call to run in the original code but not in the modularized code.

You can fix this by specifying the full type for the parser:

let p: Parser<string, unit> = pstring "foo"

Then, when you combine several parsers, you'll only need to specify this once and it will disambiguate for all parsers that use it or that it uses. It's typically done on the final parser.

let p1 = pstring "foo"let p2 = pstring "bar"let p: Parser<string, unit> = p1 <|> p2

Viewing all articles
Browse latest Browse all 38

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>