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

Expose the internal haskell-ci library #302

Closed
RyanGlScott opened this issue Aug 29, 2019 · 12 comments
Closed

Expose the internal haskell-ci library #302

RyanGlScott opened this issue Aug 29, 2019 · 12 comments

Comments

@RyanGlScott
Copy link
Contributor

Currently, haskell-ci's library is internal, which makes it inaccessible to other projects. I'd like to depend on some bits of haskell-ci that I use in my project, but since the library is internal, I'm forced to copy-and-paste large chunks of it (example). Exposing it so that I could depend on haskell-ci as a library seems like a much more direct option.

@phadej
Copy link
Collaborator

phadej commented Aug 29, 2019

What particular parts you interested in?

I think this is moral duplicate of haskell/cabal#6090

I don't want to maintain cabal.project parser for any other need than haskell-ci has. You can extract the code, make it into library, and "we" can consider using it in haskell-ci for parsing cabal.project files if it becomes general enough for any to use.

@RyanGlScott
Copy link
Contributor Author

I need HaskellCI.Project (and its transitive imports).

To be clear, I'm not asking that the API for this remain stable—this is for an internal tool of mine that will never go on Hackage. I'm quite willing to adapt to any changes on haskell-ci's side.

@RyanGlScott
Copy link
Contributor Author

Also, I don't particularly care where this code lives, be it in haskell-ci, cabal-install, a hypothetical cabal-project-parser library, or somewhere else.

@RyanGlScott
Copy link
Contributor Author

RyanGlScott commented Sep 26, 2019

Would you be opposed to putting the parser-related bits in a public library within haskell-ci.cabal?

@RyanGlScott
Copy link
Contributor Author

Actually, #302 (comment) is probably a non-starter, as multiple public libraries are only supported with GHC 8.8.1 or later, which would cut off haskell-ci's support window considerably.

@RyanGlScott
Copy link
Contributor Author

As an alternative approach, I've isolated the cabal.project-parsing bits into https://github.com/RyanGlScott/cabal-project-parser. We could conceivably expose just this while keeping the rest of the haskell-ci library internal.

@RyanGlScott
Copy link
Contributor Author

Ping @phadej

@phadej
Copy link
Collaborator

phadej commented Oct 21, 2019

Yes, let's do some cabal-project-parser library. I'm not found of exposing ParsecError: it's a module which probably should even exist in Cabal-the-library. I copy paste it around (from cabal-install).

Also, I'd like the library to have functionality not only parsing, but also globbing & parsing the actual .cabal files.

I'll tick that as my next thing to do for haskell-ci.

@RyanGlScott
Copy link
Contributor Author

Yes, let's do some cabal-project-parser library.

Awesome! I created https://github.com/RyanGlScott/cabal-project-parser as a proof-of-concept, but I'd be happy to give you push access (or ownership) if you want to make further improvements.

I'm not found of exposing ParsecError

Indeed, that does seem a bit code-smelly. Would a reasonable alternative be to have parseProjectFile return an Either ParseErrorDataType (Project String String), where ParseErrorDataType is some bespoke data type that contains all of the arguments to be passed to renderParseError, and then only implement renderParseError within haskell-ci's internal library?

Also, I'd like the library to have functionality not only parsing, but also globbing & parsing the actual .cabal files.

That would also be nice. If it does that, we should probably think of a different library name than cabal-project-parser :)

@RyanGlScott
Copy link
Contributor Author

cabal-parsers was split off in #321, so closing.

@phadej
Copy link
Collaborator

phadej commented Nov 24, 2019

@RyanGlScott
Copy link
Contributor Author

Thanks again!

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

2 participants