I am posting for help trying to come up to speed on Haskell to be able to learn program language parsing.
I have been trying to learn Haskell for the past week because of trying to understand Packrat parsing.
In attempting to learn Haskell, which appears to be a fascinating language I might want to add to my toolbox permanently — I keep running into constant roadblocks.
After much trial and error I was finally about to get VS Code and a debugger to work by downgrading to 8.10.4 but I still cannot get any Haskell projects I have tried to build, run or work in the debugger. The best I can do is get very trivial tutorial examples to build/debug/run. But those example obviously don’t show me the workflow of real-world Haskell program.
Two of the projects I have tried to get working are these named GitHub repos (vs hyperinks since new Discourse users can only post one link) but both throw a lot of errors, probably because they were written in older versions of Haskell that are no longer compatible. Whatever the case, I have no idea how to fix them:
GitHub: /MarkMcCaskey/Pappy
GitHub: /tanakh/Peggy
Can anyone point me to a working fork of these that I can debug in VSCode, point me to a similar smaller but real-world program in Haskell that I can just clone and debug for learning, or point me to a tutorial that allows me to learn how to get a real program working, and not just learn the syntax of the language Haskell like the otherwise excellent “Learn you a Haskell” tutorial covers?
This is a bit more advanced than you may need, but my grammatical-parsers package contains a Packrat implementation among others. The paper linked from README also explains the Packrat implementation.
Thanks for your reply.
Regarding the change to MonadFail, I had indeed discovered that and had tried what you proposed, but then I get this error message, which I had given up on and decided to write the forum post:
src/Parse.hs:115:9: error:
‘fail’ is not a (visible) method of class ‘Monad’
|
115 | fail [] = Parser (\dvs -> NoParse (nullError dvs))
| ^^^^
cabal: Failed to build pappy-0.1.0.3. See the build log above for details.
As for the rest being only warnings, in my other languages (Go, PHP) I always strive for zero warnings because then I know that what I am doing is either correct or it is my code generating new warnings. And especially for a newbie to Haskell it sure makes learning how Haskell works much harder.
That error probably means you haven’t changed the file properly. Did you save the file after making changes? Can you post a snippet of the new file you made (e.g. lines 100 to 130)?
Thanks for the follow up. I literally just uninstalled everything because the Haskell Language Server kept crashing so as I couldn’t debug in VSCode. I will need to reinstall everything before I can reply, but I don’t have time to do that until much later today.
At this point I am happy to have any version installed, let alone switching versions, and I have just uninstalled everything so it won’t be until later that I can even try. Beyond that, I have no clue how to switch versions, especially given my confusion over cabal vs. stack vs. ghcup vs. ???
BTW, for a newbie to a language it’s really hard to learn when you can’t find a stable working base to start with.
That is how I usually learn; start with a known good base and then make small changes to see what happens. Hoping I can get a stable working base to start to learn Haskell before I run out of free time.