Skip to content

Use MonadRec for many #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 28, 2016
Merged

Use MonadRec for many #24

merged 2 commits into from
Oct 28, 2016

Conversation

garyb
Copy link
Member

@garyb garyb commented Oct 28, 2016

Rebased version of #21 (thanks @nwolverson!)

Resolves #21, resolves #9.

@paf31
Copy link
Contributor

paf31 commented Oct 28, 2016

Looks great, but should this go in lists instead?

@garyb
Copy link
Member Author

garyb commented Oct 28, 2016

Oh right, we already have it there. In that case I'll drop it and add a re-export instead.

@garyb garyb closed this Oct 28, 2016
go :: List a -> Parser (Step (List a) (List a))
go acc = do
aa <- (Loop <$> p) <|> pure (Done unit)
pure $ bimap (flip Cons acc) (\_ -> reverse acc) aa
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or _ : acc?

@garyb garyb reopened this Oct 28, 2016
@paf31
Copy link
Contributor

paf31 commented Oct 28, 2016

True, but the version in lists isn't stack safe.

@garyb
Copy link
Member Author

garyb commented Oct 28, 2016

How's this?

@paf31
Copy link
Contributor

paf31 commented Oct 28, 2016

Looks great!

@garyb garyb merged commit 9781f0a into master Oct 28, 2016
@garyb garyb deleted the monadrec-many branch October 28, 2016 19:24
@nwolverson
Copy link
Contributor

Nice :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Not stack safe
3 participants