@paluh discovered an edge case where pulp build compiles fine but pulp docs fails, as demonstrated in this repo: https://github.com/paluh/purescript-pulp-publish-problem
In particular, there is an error thrown in newtype deriving with QC's newtype Gen a = Gen (State GenState a) that is fixed by using StateT GenState Identity a.
My suspicion is that this is a result of failing to desugar the State type synonym, it seems like an edge case not handled in amongst the cleverness in Language.PureScript.Docs.Convert.
It seems to be triggered by the need to typecheck when a top-level declaration is not given a type annotation. (And, indeed, most libraries tend to have all of their declarations filled in, so it seems to be a rare issue.) But even adding the missing annotations to the original library did not seem to fix it, so I must not understand the full picture yet.
Is there anyone familiar with this that could comment? Or I could just dig in myself (later) and see if I come up with anything ...
What you鈥檝e said seems reasonable. Unfortunately desugaring type synonyms is purposefully left out because it鈥檚 not really an option - if people use type synonyms in their signatures, we need to preserve those. Imagine what the lens library would come out like if we didn鈥檛, for example.
I wonder if we should just compile normally before producing docs and then extract any missing type signatures from the externs.json file.
I would like to better understand the issue before trying to address it though, so I鈥檇 appreciate it if you were able to keep digging a little.
I'm going to close this as a duplicate of #3624 as I am pretty sure that that is the same issue, and we now have a reproduction for that issue.