Suppressing False Incomplete Pattern Matching Warnings for Polymorphic Pattern Synonyms
Shayan Najd
sh.najd at gmail.com
Thu Oct 25 11:36:10 UTC 2018
Dear GHC hackers,
On our work on the new front-end AST for GHC [0] based on TTG [1], we
would like to use a pattern synonym like the following [2]:
{{{
pattern LL :: HasSrcSpan a => SrcSpan -> SrcSpanLess a -> a
pattern LL s m <- (decomposeSrcSpan -> (m , s))
where
LL s m = composeSrcSpan (m , s)
}}}
We know that any match on `LL` patterns, makes the pattern matching
total, as it uses a view pattern with a total output pattern (i.e., in
`decomposeSrcSpan -> (m , s)`, the pattern `(m , s)` is total).
As far as I understand, currently COMPLETE pragmas cannot be used with
such a polymorphic pattern.
What do you suggest us to do to avoid the false incomplete pattern
matching warnings?
Thanks,
Shayan
[0] https://ghc.haskell.org/trac/ghc/wiki/ImplementingTreesThatGrow
[1] https://ghc.haskell.org/trac/ghc/wiki/ImplementingTreesThatGrow/TreesThatGrowGuidance
[2] https://ghc.haskell.org/trac/ghc/wiki/ImplementingTreesThatGrow/HandlingSourceLocations
More information about the ghc-devs
mailing list