Ghc does not report non-exhaustive pattern matching when using the `no-code` flag

I often repeat typecheck my programs in the terminal, changing them in my selection editor to get real-time feedback. Usually I run something similar to: watch -d -n 1 "ghc -fno-code NoIncompletePM.hs" .

Unfortunately, the no-code flag that I use to avoid compiling the code again and again doesn’t seem to be compatible with warn-incomplete-patterns anyway. For instance. with this program:

 {-# OPTIONS -Wall #-} module NoIncompletePM where argh :: Bool -> Bool argh True = True 

I never get a warning that argh missing a case for False . You can get all of these warnings by removing the no-code flag and adding force-recomp one (so that the warning displays every time, and not just the first time it is compiled), but I definitely want to avoid compiling this code ...

I could not find anything in the manual describing them as incompatible, so I assume that this is either unexpected behavior, or I am doing something wrong. Any clues?

+5
source share
1 answer

This is a known ghc error:

https://ghc.haskell.org/trac/ghc/ticket/8101

Note that if you pass the -c flag for single shot mode, you will receive warnings. So there is a workaround for now.

Unfortunately, it appears ( https://ghc.haskell.org/trac/ghc/ticket/10600 ) that ghc 8.0 can cancel this work even in a single operation, at least for another release cycle.

+1
source

Source: https://habr.com/ru/post/1209878/


All Articles