Chris Stryczynski

Software Developer / Consultant

Disable Haskell warnings and errors in a single file

If you want to super charge your Haskell, I would highly recommend having -Wall enabled (show all warnings), this can be done on a project-basis by having a .ghci file with the following line:

    :set -Wall

Things like unnessary imports, unused defintitions become warnings and if you avoid these things your code becomes a lot more lean.

However sometimes I find I’m writing a new module and I’m experimenting and all these errors get in the way. Well you can turn them off in just a specific file by adding a ‘no’ option like one of the following lines:

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