purescript-contrib/purescript-optparse

Document differences between `optparse-applicative` and `purscript-optparse`

Opened this issue · 0 comments

deemp commented

Is your change request related to a problem? Please describe.

I wanted to do asum over a list of parsers.
I was looking for an instance of Plus for a Parser from this library and didn't find it.

I discovered that purescript-optparse and optparse-applicative use different definitions of the Parser data type.

Here's one used by purescript-optparse
https://github.com/f-o-a-m/purescript-optparse/blob/dbc4c385e6c436eed4299ae2c0bb2cc278cf2410/src/Options/Applicative/Types.purs#L308-L313

And one used by optparse-applicative.
https://github.com/pcapriotti/optparse-applicative/blob/4196aa7d42c9f9d9295735b402a4339709e84512/src/Options/Applicative/Types.hs#L254-L260

In optparse-applicative, a Parser has a NilP (Maybe a) constructor so it's possible to define empty = NilP Nothing
https://github.com/pcapriotti/optparse-applicative/blob/4196aa7d42c9f9d9295735b402a4339709e84512/src/Options/Applicative/Types.hs#L304

However, purescript-optparse uses a NilP a constructor so it's impossible to define empty.

This change was introduced by #20.

Describe the solution you'd like

Add a section to README that explains the differences between the libraries.