attoparsec

Problem with incomplete input when using Attoparsec

江枫思渺然 提交于 2019-12-01 04:10:18
I am converting some functioning Haskell code that uses Parsec to instead use Attoparsec in the hope of getting better performance. I have made the changes and everything compiles but my parser does not work correctly. I am parsing a file that consists of various record types, one per line. Each of my individual functions for parsing a record or comment works correctly but when I try to write a function to compile a sequence of records the parser always returns a partial result because it is expecting more input. These are the two main variations that I've tried. Both have the same problem.

Problem with incomplete input when using Attoparsec

空扰寡人 提交于 2019-12-01 01:36:39
问题 I am converting some functioning Haskell code that uses Parsec to instead use Attoparsec in the hope of getting better performance. I have made the changes and everything compiles but my parser does not work correctly. I am parsing a file that consists of various record types, one per line. Each of my individual functions for parsing a record or comment works correctly but when I try to write a function to compile a sequence of records the parser always returns a partial result because it is

Parsing and the use of GADTs

♀尐吖头ヾ 提交于 2019-11-30 18:45:34
问题 I've ran into a problem while writing a parser. Specifically, I want to be return values of different types. For example, I have two different data types FA and PA to represent two different lipid classes - data FA = ClassLevelFA IntegerMass | FA CarbonChain deriving (Show, Eq, Ord) data PA = ClassLevelPA IntegerMass | CombinedRadylsPA TwoCombinedRadyls | UnknownSnPA Radyl Radyl | KnownSnPA Radyl Radyl deriving (Show, Eq, Ord) Using attoparsec, I have built parsers to parse lipid shorthand