Problems when trying to run FParsec in F# Interactive
Asked Answered
F

1

10

I'm trying to run some FParsec code in F# Interactive but with no success. I am able to build and run this tutorial.fs file, but the same isn't happening with FSI, as it didn't recognize FParsec.dll.

I've already tried running the #r "Parsec" command in FSI but it was of no avail.

Anyone has a clue on what might be the problem here?

enter image description here

Fallfish answered 22/8, 2011 at 2:55 Comment(0)
P
15

FParsec is not GAC installed, therefore you need to put the full path to the dll in the #r directive, not just the name of the assembly. Also, don't forget that "...FParsec is built as two DLLs. The C# bits are compiled into the FParsecCS.dll and the F# bits (which depend on the C# bits) are compiled into FParsec.dll." (section 3.2 of the documentation). e.g.

#r @"C:\FParsecCS.dll"
#r @"C:\FParsec.dll"
Paralipomena answered 22/8, 2011 at 3:15 Comment(5)
I was sure I had tried it with the full path, too. Seems I was mistaken.Fallfish
If you are always using the dll you can add it to FSI automatically via the command line with -r "C:\Fparsec.dll". The option is hiding in the FSI options in visual studioNodule
Also, be sure you reference FParsecCS before FParsec, otherwise you'll get an error FS0074.Leboeuf
Reset the Interactive after every script change.Spectrometer
In visual studio, to reset the interactive F# window, right-click anywhere in the F# interactive window -> "Reset Interactive Session"Lienlienhard

© 2022 - 2024 — McMap. All rights reserved.