[Haskell-beginners] Parsing a file

Roger Mason rmason at mun.ca
Wed Jan 26 13:32:04 UTC 2022


Hello Francesco,

Thanks for your response.

Francesco Ariis <fa-ml at ariis.it> writes:

>
> The problem is with this line
>
>>      Parsec.parse species "test species" eqatoms
>
> `parse` returns an Either, so you should pattern match on
> its `Left` and `Right` (using `case` or the `either` function).
> This has to be done inside a `let` too, because parse is a pure
> function.
> Does that help?

I'll need to check exactly how to use case for this, but before I do I
have this question.

=Parsec.parse species "test species" "this that"= worked fine in my
tests.  Why has `parse` changed changed its return type when invoked as

=Parsec.parse species "test species" eqatoms=

That is confusing (and off putting) and makes it hard to test ones code.

Thanks,
Roger


More information about the Beginners mailing list