Parsec is a parser library for the Haskell programming language.

learn more… | top users | synonyms

2
votes
1answer
58 views

Parsing a component of a regex followed by an optional quantifier character

I have a piece of parsec code that parses a unit optionally followed by ?, + or ...
3
votes
1answer
39 views

Parsing characters with parsec

I am trying to parse escape sequences as well as plain characters. Can this be made more succinct? ...
3
votes
0answers
35 views

Generation and parsing of English numerals (cardinal and ordinal)

I need to use the English numerals (American) in Haskell, so I looked for a library that did it. I have not found one, therefore I developed the program that I am presenting here. There are actually ...
0
votes
0answers
35 views

Parsec for primes and fibs

I decided to spend some time working with parsec. I've written some code to check for primality and for whether something is a Fibonacci number. I'm mainly hoping for feedback on readability, but if ...
1
vote
1answer
31 views

Assorted Date Parser

I've written a date parser that parses different types of dates using Parsec. Credit for the original problem goes to here. The following formats are as such: ...
0
votes
0answers
72 views

Parsing Markdown with Parsec

Are there better ways to refactor the code? I would like to avoid try. What do you think of the type-annotation-block? ...
0
votes
0answers
134 views

Readability of a point-free applicative parser

I am writing an applicative parser, which you can think of as a minimal Parsec, just to educate myself. I got started with the excellent tutorial from this StackOverflow answer. Here is the relevant ...
5
votes
1answer
120 views

Using Parsec for simple arithmetic language

I've been reading Types and Programming Languages and I wanted to try to implement the first language in Haskell to understand it properly I have barely written any Haskell before and not used Parsec ...
1
vote
1answer
145 views

block comment parser implementation for “monadic parser combinators”

I'm reading monadic parser combinators. On the page 23, they leave an exercise for defining a Gofer block comment parser, and I try to implement it in Haskell. My code is here: ...
2
votes
0answers
69 views

TOML Parser with Parsec

i wanted to practice parsec and thought about doing a TOML parser for fun. i am looking for both directions on how to fix the remaining problems, but even more some hints on my style. the one ...
4
votes
1answer
444 views

Using Parsec for lexing&parsing

I'm creating list of Tokens from input [Char] stream using Parsec v3. The definition of ...
10
votes
1answer
2k views

Parsing strings with escaped characters using Parsec

I have been working through the exercises in a Write Yourself a Scheme in 48 Hours/Parsing and hacked together something to get parseString to comprehend escaped characters. Also had some inspiration ...
5
votes
2answers
634 views

INI File Parser in Haskell

I'm learning Haskell at the moment, and have just written my first useful module - a parser fo INI files. I used Parsec. I'd like to know what can be improved here - or maybe I did some things ...
7
votes
1answer
760 views

First attempt at a SVG parser

I figured it's about time to jump into some Haskell, so here's a first attempt at an oddly specific SVG parser: ...