Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3356836
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:33:38+00:00 2026-05-18T02:33:38+00:00

When I try to parse many p , I don’t receive the ‘expecting p’

  • 0

When I try to parse many p, I don’t receive the ‘expecting p’ message:

> parse (many (char '.') >> eof) "" "a"
Left (line 1, column 1):
unexpected 'a'
expecting end of input

Compare to

> parse (sepBy (char '.') (char ',') >> eof) "" "a"
Left (line 1, column 1):
unexpected 'a'
expecting "." or end of input

which reports “.” as I’d expect. many1 p <|> return [] works as well.

All of these functions accept empty input, so why doesn’t many report what it’s expecting? Is it a bug or a feature?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T02:33:39+00:00Added an answer on May 18, 2026 at 2:33 am

    In a somewhat superficial sense, the reason for the difference in behavior is that many is a primitive parser whereas sepBy is constructed in a similar manner to your reimplemented many. In the latter case, the “expecting…” message is constructed based on alternatives that were available along the path that led to the parse failure; with many there were no such choices, it merely succeeded unconditionally.

    I don’t know that I’d describe this as either a bug or a feature, it’s just sort of a quirk of how Parsec works. Error handling is not really Parsec’s strength and this really doesn’t seem like the first thing I’d worry about in that regard. If it bothers you sufficiently you may be better served by looking into other parsing libraries. I’ve heard good things about uu-parsinglib, for instance.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following Python code: import xml.dom.minidom import xml.parsers.expat try: domTree = ml.dom.minidom.parse(myXMLFileName)
I try to write a simple Markdown parser in JavaScript. Therefore I want to
I'm using IPAddress.TryParse() to parse IP addresses. However, it's a little too permissive (parsing
Try loading this normal .jpg file in Internet Explorer 6.0. I get an error
try { ... } catch (SQLException sqle) { String theError = (sqle).getSQLState(); ... }
I want to use the DateTime.TryParse method to get the datetime value of a
I'm currently refactoring code to replace Convert.To's to TryParse. I've come across the following
uint color; bool parsedhex = uint.TryParse(TextBox1.Text, out color); //where Text is of the form
Out style: bool result; if(something.TryParse(val, out result)) { DoSomething(result); } Nullable style: bool? result
Seeing as Java doesn't have nullable types, nor does it have a TryParse(), how

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.