A fast Haskell library for parsing ByteStrings
Questions tagged [attoparsec]
131 questions
1
vote
1 answer
Conduit and Attoparsec: unexpected termination on parse error
I'm trying to convert a log file parser that I wrote a while back over to conduit, and I'm running into an issue. I'll simplify the details of the parser itself since that's not relevant to the question. I have a log file that looks like this:
200…

mazelife
- 2,069
- 17
- 12
1
vote
1 answer
Reading POT files in Haskell using Attoparsec
I have a set of POT files that I want to read in order to postprocess translations in Haskell. Due to the POT files being very large, I want to use attoparsec to get a good performance.
I tried using hgettext, but my task is not to read translations…

Uli Köhler
- 13,012
- 16
- 70
- 120
1
vote
1 answer
attoparsec high memory usage reading huge file
I've tried many approachs for parsing a file content line by line, but at the present time is not working and when it runs, uses a lot of memory (more than 16GB).
This is a subset of the file I want to parse http://lpaste.net/144719
I want three…

freinn
- 1,049
- 5
- 14
- 23
1
vote
0 answers
How can I parse up to a character, then parse what that matches in Attoparsec?
I'm writing a parser for a logfile. One of the lines in the logfile lists the parameters of an HTTP request:
Parameters: {"back"=>"true", "embed_key"=>"12affbbace", "action"=>"index", "ajax"=>"1", "controller"=>"heyzap", "embed"=>"1"}
I'm having…

MaxGabriel
- 7,617
- 4
- 35
- 82
1
vote
0 answers
Making Attoparsec based parser more efficient
I wrote a simple text STL (Standard Tessellation Library) parser using Attoparsec. STL contains a collection of facets. Each facet contains a normal, and vertices of triangle. Typical STL file can be large (~100 Mb or more).
STL file format…

Yogesh Sajanikar
- 1,086
- 7
- 19
1
vote
1 answer
What about Data.Attoparsec.ByteString.Lazy.Char8?
Attoparsec has modules specialized for Strict/Lazy, ByteString/Text, Char8 (ascii)/Char. But it doesn't have all the combinations.
I think Data.Attoparsec.ByteString.Lazy.Char8 which isn't provided would be particularly convenient for grinding…

Michael Fox
- 3,632
- 1
- 17
- 27
1
vote
0 answers
Efficient "Parser a -> ByteString -> [a]" function
What is the most efficient way to parse a large text content (300K+) for all matches of already created Attoparsec parser?
I have written a slow performant code like that:
import Data.Either (rights)
findAll :: Parser a -> String -> [a]
findAll…

The_Ghost
- 2,070
- 15
- 26
1
vote
1 answer
attoparsec Illegal equational constraint
as of the time of this writing, I'm running the newest GHC (7.9.20140608) and cabal (1.20.0.0), and it seems that attoparsec is failing.
Data/Attoparsec/ByteString/Internal.hs:519:7:
Illegal equational constraint a_audv ~ (ByteString, t)
…

Athan Clark
- 3,886
- 2
- 21
- 39
1
vote
1 answer
Haskell attoparsec: "Failed reading: satisfyWith"
I want to parse text like "John","Kate","Ruddiger" into list of Strings.
I tried to start with parsing "John", to Name (alias for String) but it already fails with Fail "\"," [","] "Failed reading: satisfyWith".
Question A: Why does this error occur…

A123321
- 837
- 11
- 21
1
vote
1 answer
Implementing takeTill1 in attoparsec
Attoparsec provides the function takeWhile1 that consumes at least one character.
However, there is no analog for takeTill. How can I implement this function takeTill1?
Note: This question intentionally shows no research effort as it was answered…

Uli Köhler
- 13,012
- 16
- 70
- 120
1
vote
2 answers
How do I use takeTill until a tab or newline in Haskell Attoparsec? (Problems with Boolean expressions)
I'm writing my first Haskell program. The program parses ordinary CSV files, but I'm running into many issues that no doubt stem from my inexperience with the syntax.
Currently, the code parses one record successfully, but on the final record, the…

Irwin
- 422
- 5
- 13
1
vote
2 answers
Typechecking problems with pipes-attoparsec
I've been trying out pipes-attoparsec but haven't been having much luck.
It appears that there is a type mismatch between Void and X in (what seems to be) relatively straightforward code. From what I've read in the library (that this will be a type…

user1219
- 103
- 5
1
vote
0 answers
Compile error with Attoparsec Text Lazy
I am new to haskell, and the code below
import Data.Attoparsec.Text.Lazy
import qualified Data.Text.Lazy as T
toEol :: Parser T.Text
toEol = takeTill isEndOfLine
produces the following error message:
Couldn't match type `Data.Text.Internal.Text'…

dri
- 11
- 2
1
vote
1 answer
Parse comma separated strings inside parens with attoparsec
Sorry for dumb question.
I have some kind of SQL schema, that looks like this (for example):
create table test_table (
id integer not null,
title text,
primary key ("id")
);
create table test_table2 (
id integer not null,
…

Semyon Novikov
- 261
- 4
- 10
1
vote
1 answer
Try parsing from the next special symbol occurence if parser is failed
Suppose there is some parser:
valid :: Parser String
valid = string "valid" <* skipWhile (/= '\n')
It could be used for getting "valid" strings from the multiline text:
> parseOnly (many $ valid <* optional endOfLine) "valid\nvalid\nvalid"
Right…

ДМИТРИЙ МАЛИКОВ
- 21,474
- 11
- 78
- 131