JakeWheat / intro_to_parsing

Introduction to parsing with Haskell and Parsec
http://jakewheat.github.io/intro_to_parsing/
BSD 3-Clause "New" or "Revised" License
503 stars 35 forks source link

Tutorial is out of date #11

Open drake-mer opened 6 years ago

drake-mer commented 6 years ago

Tutorial on parsec is out of date, doesn't work with current latest Haskell/GHC distribution for various reason. I would be glad to submit a pull request to fix it.

JakeWheat commented 6 years ago

Thanks for the heads up, a pull request would be great.

DavidAntliff commented 5 years ago

One item in particular - the many combinator is not in scope at the point where the tutorial uses it (many1 is though). I'm not sure what the workaround is yet.

@elijahbal are you still planning to submit a PR to update the tutorial? It would be a lot more useful to people if it worked with the latest GHC.

DavidAntliff commented 5 years ago

Apparently the workaround is to add > import Control.Applicative (many) to GettingStarted.lhs.

EDIT: > import Text.ParserCombinators.ReadP (many) might be better - I don't know enough to decide.

Also, I had to add > import Control.Monad (void) to get void, mentioned in section 3.3.

drake-mer commented 5 years ago

@DavidAntliff I don't really have the time anymore to focus on it but if really you are encouraging me I can delve into it. I'm with you in any case.

DavidAntliff commented 5 years ago

@elijahbal It's ok, I've been finding the issues as I go and working out how to get past them. I don't need anything, had just wondered if maybe a PR was still on its way - no problem if not.

FranklinChen commented 5 years ago

Also, adding a Cabal file for a full build would be nice.

JakeWheat commented 5 years ago

Hi All,

I did a quick check with ghc 8.6.5, and did some small fixes. If you find any issues, please say which exact line fails for you (and provide a patch or the fix in a comment or bug report), then I can fix it. I didn't manage to find where either 'many' or 'void' were missing, but maybe these were added to the exports in updates to the parsec package after you looked at the tutorial?

I also added a cabal file, so now you can do something like 'cabal new-repl'. It works, but it's not quite right yet - you get some warnings to ignore.