
Would it be possible to extend the DEPRECATED pragma to allow one to deprecate an instance of a class? I was thinking about the recent discussion of APIs on haskell-cafe, where Jérémy Bobbio complained about using Booleans as arguments to libaray functions, preferring instead sensibly named data constructors. It occurred to me that by defining a class one could allow both the old interface and a better one by using a class: module Main where -- suppose f used to be Bool -> Int -> Int, replace it -- with this: f :: Toggle t => t -> Int -> Int f t x = case enabled t of Invert -> -x DontInvert -> x data DoInvert = Invert | DontInvert class Toggle t where enabled :: t -> DoInvert instance Toggle DoInvert where enabled = id instance Toggle Bool where enabled True = Invert enabled False = DontInvert but for this to be any real use, we'd have to be able to deprecate the /instance/ Toggle Bool. -- Jón Fairbairn Jon.Fairbairn at cl.cam.ac.uk