felixSchl / neodoc

Beautiful, hand-crafted commandline interfaces for node.js
https://felixschl.github.io/neodoc
MIT License
226 stars 9 forks source link

purescript example #25

Open Fresheyeball opened 8 years ago

Fresheyeball commented 8 years ago

It would be nice to see a purescript usage example along side the JS one.

felixSchl commented 8 years ago

I have not given it much thought how to actually use neodoc from purescript, but I'd love to get that sorted. The last step currently results in a StrMap Value, where Value is just a simple ADT to wrap javascript types. Do you think this representation is sufficiently expressive to use from within purescript? I chose it because I could easily strip the constructors and arrive at the underlying JS values. I have seen in other languages amazing things being done, e.g. to create a struct that matches the specification: docopt.rs (see second example). I don't think this would be possible with purescript, though, do you?

The impure entrypoint to docopt lives in the top-level Docopt module. This could be imported and called into once we decide on how to model the output nicely.