There's an annoying "feature" that deriving instances are also affected by the RebindableSyntax extension. Example of what I want to write:
{-# LANGUAGE RebindableSyntax #-}
import qualified Prelude
data Color = Red | Green | Blue | Periwinkle | Fuschia deriving (Prelude.Eq, Prelude.Ord)
This comes up with the error " Not in scope: `ifThenElse' ".
That seems like a misfeature to me--the
derivingclause is full of built-in magic anyway, so I'm skeptical that derived instances using rebound syntax would be useful in practice. Now, if you could also rebind thederivingclause itself and use a TH splice instead... but I digress.I suspect the simplest and easiest solution is to use different modules. Put the data type definition in its own module, use the
derivingclause there with the Prelude functions in scope, then import the type in the module using rebindable syntax. If you need further modularity in your modules, note thatStandaloneDerivingalso exists, and would let you define the types in one module (withRebindableSyntaxactive), derive the instances in another module (withoutRebindableSyntax), and import both from modules that actually use the type.