jgm/pandoc-types

COMPLETE pragmas in Legacy.Definition

Closed this issue · 2 comments

It is possible to convince GHC that a collection of patterns is complete, say by writing {-# COMPLETE Format :: D.Format #-} in Legacy.Definition. This would make it unnecessary to silence the incomplete pattern match warnings. I did not know that when writing the modules, and by the time I got to pandoc it was easier to silence the warnings while working rather than add the pragmas. I can write a request that adds them, if that would be welcome.

Just now I tested them on the pandoc commit right after I switched it to Legacy.* and they did suppress the warnings, but I got other warnings like

    Pattern match checker exceeded (2000000) iterations in
    an equation for ‘fixBlocks’. (Use -fmax-pmcheck-iterations=n
    to set the maximun number of iterations to n)
    |               
846 |   let fixBlocks (b : CodeBlock attr x : rest)

so it may not be a perfect solution.

jgm commented

Probably worth doing!

Resolved by commit efc6540