-
Notifications
You must be signed in to change notification settings - Fork 3
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
Discover more modules (exes, sub-libraries, test-suites) #16
Conversation
exe Main modules are prefixed with the exe name, fixing this old graphmod bug: yav/graphmod#28
otherMod <- "Main" : buildInfo.otherModules | ||
pure Module | ||
{ name = fromString $ | ||
if otherMod == "Main" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is kind of a dumb way to do this, but it works.
@@ -20,3 +20,7 @@ test: graphex.cabal | |||
fmt: | |||
fd .hs --exec stylish-haskell -i | |||
.PHONY: fmt | |||
|
|||
graph.json: | |||
cabal run -v0 exe:graphex -- cabal > graph.json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need -v0
due to haskell/cabal#7790
I want to make discovery command-line configurable + allow the user to optionally also discover external modules as well. |
The only thing left is to add to the existing |
fs <- getDirectoryContents "." -- XXX | ||
mods <- fmap fold . traverse discoverCabalModules . filter ((".cabal" ==) . takeExtension) $ fs | ||
mods <- fmap fold . traverse (discoverCabalModules opts) . filter ((".cabal" ==) . takeExtension) $ fs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I keep feeling like fmap fold . traverse
should be a thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's foldMapA
? But it's one pass:
foldMapA
:: forall t f a b
. Foldable t
=> Applicative f
=> Monoid b
=> (a -> f b)
-> t a
-> f b
foldMapA f = getAp . foldMap (Ap . f)
Hm I should probably write a proposal to add it to base
. I always write it in new projects 😆
exe
Main
modules are prefixed with the exe name, fixing this oldgraphmod
bug: yav/graphmod#28Fixes #8