Skip to content
CCPEDIAby Unity Nodes
App Development

How to disable all warnings for one file only?

2 posts1,023 views3 likesLast activity Sep 2021

  1. Richard_KapolnaiOP 1

    I’d like to keep both warnings in a project, and some code source raising false warnings. So I’d like to disable all warnings for individual files.
    The example for which I’d appreciate a solution is here: Exception where clause produces warning "Defined but not used: ‘this’" · Issue #11004 · digital-asset/daml · GitHub
    I already tried these:

    {-# OPTIONS_GHC -fno-warn-unused-top-binds #-}
    {-# OPTIONS_GHC -fno-warn-unused-binds #-}
    {-# OPTIONS_GHC -Wno-unused-top-binds #-}
    {-# OPTIONS_GHC -Wno-unused-binds #-}
    {-# OPTIONS_GHC -Wno-error #-}
    
    {-# OPTIONS -fno-warn-unused-top-binds #-}
    {-# OPTIONS -fno-warn-unused-binds #-}
    {-# OPTIONS -Wno-unused-top-binds #-}
    {-# OPTIONS -Wno-unused-binds #-}
    {-# OPTIONS -Wno-error #-}
    
  2. cocreature 2

    To disable just this warning you need the following:

    {-# OPTIONS -Wno-unused-matches #-}
    

    To find the right warning your best bet is probably to look at 5.2. Warnings and sanity-checking — Glasgow Haskell Compiler 9.0.1 User's Guide or my short reference (which isn’t exhaustive) at Making the most out of DAML Compiler warnings.

    Alternatively, if you just want to undo your -Wall there is -Wno-all. If you want to undo -Werror and go back to warnings instead there is -Wwarn.