Internal types leaking into public API #38

Closed
dag opened this Issue Dec 26, 2012 · 6 comments

Comments

Projects
None yet
3 participants
Contributor

dag commented Dec 26, 2012

With 0.5, I had to

import           Options.Applicative.Builder.Internal (ArgumentFields, Mod,
                                                       OptionFields)

because I have things like

valueAll :: (Bounded a, Enum a) => Mod f [a]
valueAll = Opt.value [minBound..]

Previously these types were exported from Options.Applicative, which I think is useful because it allows you to write type signatures for reusable pieces of code.

Contributor

dag commented Dec 26, 2012

Maybe also some or all of the types in the .Types module, especially Parser itself, but maybe not the (term-level) constructors. Another option is to export the .Internal types from .Types.

Currently I need three different imports for optparse, one of which is internal.

I did the exact same thing and had the exact same issue.

Owner

pcapriotti commented Mar 17, 2013

I added some exports in Builder. Does that fix the issue?

Contributor

dag commented Mar 18, 2013

It does fix the issue of having to import .Internal in my case, although I'd still like for at least Parser to be exported from Options.Applicative in some way.

In my particular case I also need import Options.Applicative.Types (Completer(..)) because I'm getting completions from a database and doing the prefix check myself in the query as an optimization (listIOCompleter would be slower), but perhaps that's a special case, or perhaps the right solution for that would be to add a completer = Completer to Options.Applicative.Builder.Completer or something?

Owner

pcapriotti commented Mar 18, 2013

although I'd still like for at least Parser to be exported from Options.Applicative in some way

But it is, isn't it? It comes from Common.

In my particular case I also need import Options.Applicative.Types (Completer(..)) because I'm getting completions from a database and doing the prefix check myself in the query as an optimization

Yeah, that's reasonable. I've now added mkCompleter = Completer and exports.

Contributor

dag commented Mar 18, 2013

Cool, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment