cabal icon indicating copy to clipboard operation
cabal copied to clipboard

Distribution.ModuleName.fromComponents marked as deprecated but gives no alternatives

Open chreekat opened this issue 1 year ago • 2 comments

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?

chreekat avatar Feb 12 '24 12:02 chreekat

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.

mpickering avatar Feb 12 '24 18:02 mpickering

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.

chreekat avatar Feb 22 '24 13:02 chreekat