cabal
cabal copied to clipboard
Distribution.ModuleName.fromComponents marked as deprecated but gives no alternatives
Stackage.org uses this function:
Used in a function moduleNameFromComponents: https://github.com/fpco/stackage-server/blob/master/src/Types.hs#L417
which is used to generate html: https://github.com/fpco/stackage-server/blob/master/src/Handler/Package.hs#L151
What should be done instead?
I think the point is that not all Text is a valid module name, so really you should parse the proposed module name using something like simpleParse and suitably handle the failure if given invalid input.
Perhaps the solution here is to store proper ModuleName, but I can't tell from your links what the type of sppiModuleNames is.
Yeah I don't know either.
, sppiModuleNames :: !(Map ModuleNameP Bool)
I do know that ModuleNameP is a newtype wrapper over ModuleName at least.
I suspect the right thing to do might be a massive refactor and data migration on the Stackage side, but it's worth knowing that those are the stakes here.