intro_to_parsing icon indicating copy to clipboard operation
intro_to_parsing copied to clipboard

Tutorial is out of date

Open drake-mer opened this issue 6 years ago • 7 comments

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.

drake-mer avatar Jul 29 '18 13:07 drake-mer

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

JakeWheat avatar Jul 31 '18 14:07 JakeWheat

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 avatar Dec 04 '18 09:12 DavidAntliff

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.

DavidAntliff avatar Dec 04 '18 23:12 DavidAntliff

@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.

drake-mer avatar Dec 07 '18 10:12 drake-mer

@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.

DavidAntliff avatar Dec 08 '18 03:12 DavidAntliff

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

FranklinChen avatar Mar 15 '19 21:03 FranklinChen

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.

JakeWheat avatar Jul 05 '19 18:07 JakeWheat