Suppressing False Incomplete Pattern Matching Warnings for Polymorphic Pattern Synonyms

Richard Eisenberg rae at cs.brynmawr.edu
Thu Oct 25 12:51:29 UTC 2018


This sounds like an infelicity in COMPLETE pragmas. Do we have a documented reason why fixing this is impossible?

Richard

> On Oct 25, 2018, at 7:36 AM, Shayan Najd <sh.najd at gmail.com> wrote:
> 
> 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
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs



More information about the ghc-devs mailing list