parser-combinators icon indicating copy to clipboard operation
parser-combinators copied to clipboard

Generalizing over input type

Open mzero opened this issue 8 years ago • 2 comments

Any interest in generalizing this over input stream time?

I'm working on parsing MIDI messages (via JS WebMIDI API) - and recently had to essentially duplicate about half of this module so it could parse over byte streams, rather than Strings.

Many of the functions are agnostic about input stream type, and generalizing these is trivial. The rest are String specific, and might be better in a string specific module. Optionally there could be a module that makes the parsing types specific to String, and then adds the string specific functions.

mzero avatar Aug 13 '17 18:08 mzero

I haven't heard a prior proposal for this, but it may be a good idea. What would you then propose that the input becomes? A Listor Array of Char? Changing the parser type to take another type-constructor argument would do the trick I imagine.

By the way. Have you looked into elm-comidi? Maybe this already does what you try to do.

stil4m avatar Aug 13 '17 19:08 stil4m

I'm working on elm-comidi right now and debugging would be much nicer if things were in terms of a list of chars or ints (since we don't have proper bytes).

Edit: Actually, I think my debugging issues are more with how Elm is rending binary strings than the fact that they're strings.

rhofour avatar Dec 23 '17 18:12 rhofour