Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make this official Haskell port of docopt? #1

Closed
ryanartecona opened this issue Mar 14, 2013 · 7 comments
Closed

make this official Haskell port of docopt? #1

ryanartecona opened this issue Mar 14, 2013 · 7 comments

Comments

@ryanartecona
Copy link
Member

What do you think, @halst?

@keleshev
Copy link
Member

Wow, thanks for letting me know. Another port, that is excellent news! You can transfer it to docopt organization on github (see settings -> transfer). I will add you then to docopt organization.

  1. I also thought that maybe it makes sense to rename the repo to docopt.hs (alongside with other ports). However I don't know Haskell, maybe it is against some conventions?
  2. Did you use language-agnostic test-suite? For version 0.6.1 (latest release) it is located here. I hope that the format is self-explanatory (the result is expected as JSON string), but if it's not don't hesitate to ask.
  3. I can see from README that you support -o=<file>, which is unconventional and not part of docopt. It is very important that all docopt implementations work the same way, so I advise you to use the language-agnostic test-suite to check for incompatibilities.
  4. I can also see that the API is very different. In all docopt implementations it is a single function docopt with the same signature. I don't know Haskell, so it could be that the language or type system make this impossible or impractical; what is your rationale for a different API?
  5. I see you released a 0.1.0 version to Cabal. I recommend you to keep the minor and major versions in sync with the reference implementation, so e.g. when you pass 0.6.1 test-suite you can release it as 0.6.0 or 0.6.1.
  6. It would be great if someone in @docopt team who knows Haskell could review the code.

Welcome to the family :-)

@ryanartecona
Copy link
Member Author

Great, thanks! This is great news, especially considering a few months ago this was just going to be an exercise for learning Haskell :)

  1. Done.
  2. & 3. I don't have a formal test suite. I am all for consistency! I will make that my next priority.
  3. The API is indeed very different. I am definitely open for suggestions for improvements (obviously the API needs to be dead simple), but at the same time there is no possible way to have the exact same API as the rest. 2 reasons:
    1. Dictionaries (Map in Haskell) are given no special treatment. There is no concise lookup syntax like python's dict['key'], so that may not be the most concise API. Still, this can change, but it just wasn't my initial approach, because
    2. More importantly, due to Haskell's all-powerful type system, it is impossible to have Bools, Strings, and lists of Strings all as values in the same Map. Map requires a single type for its keys and a single type for its values. One way to get around this is to make a custom type that can have different values, but then that forces the user to inspect and distinguish them (not concise or very friendly). My approach was to abstract the way captured arguments are stored internally, and expose different query functions instead.
  4. It isn't actually registered/uploaded/released, I just made the cabal file because it helps manage the build system a lot. When the project comes up to speed I will track the main release version no problem.
  5. It would be great to get this reviewed! Like I said, this was an exercise in learning Haskell myself, and while I think it's been pretty successful, I could definitely use feedback from someone more experienced.

@keleshev
Copy link
Member

Great, you're now part of @docopt with full rights to all @docopt repos. You can transfer your repo now. Looking forward to see how docopt.hs evolves.

Don't hesitate to ask anything, about internals of reference implementations, versioning, testing, etc.

@ryanartecona
Copy link
Member Author

Done! Happy to be here.

I am pretty new at collaborating on Github, but I will try my best. I am pretty busy for the next several days, but I should be back mid next week. Cheers!

@rtxanson
Copy link

Hey, I'm loving this package. Any word on when it might end up in cabal?

@ryanartecona
Copy link
Member Author

@rtxanson thanks for the reminder. 👍 I had completely forgotten. It's up on cabal now (http://hackage.haskell.org/package/docopt).

Glad you're getting some use out of it! Do file an issue if you run into problems or have ideas for improvements. ⚡

@rtxanson
Copy link

I'll totally do so if I find anything. It's helping me get my first Haskell app going, so I'm really enjoying the absolute crap out of it. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants