{-# OPTIONS_GHC -fno-warn-orphans #-}


The correct pragma and flag for silencing warnings about orphan instances is the following:

{-# OPTIONS_GHC -fno-warn-orphans #-}

module Foo where


When googling something like "Haskell no warn orphan" or "Haskell don't warn about orphan instances flag", many incorrect or out-of-date suggestions come up:

-- this doesn't work
{-# OPTIONS_GHC -fno-warn-orphan-instances #-}

-- nor does this
{-# OPTIONS -fno-warn-orphans #-}

Once again, the only valid way to write this is the following:

{-# OPTIONS_GHC -fno-warn-orphans #-}

NOTE: In general, you should heed warnings about orphan instances. However, sometimes it makes sense to have orphan instances, especially when both the datatype and instance are declared in (separate) Internal modules. To any user of the package, it will appear that the instances are not orphans (as long as they don't go looking in the Internal modules).

tags: haskell