Closed nikita-volkov closed 10 years ago
Deriving Data makes a datatype non-abstract (i.e. you can construct a value of the type without going through the safe interface, in this case Data.CaseInsensitive.mk
).
I would rather keep CI abstract so that users will never rely on its implementation which means I can change it later on.
@basvandijk Does keeping it abstract really matter when all imaginable types that it makes sense to use with CI
do have the Data
instance? On the contrary side the absence of the Data
instance makes it impossible to implement other types requiring Data
in terms of CI
. It is also impossible to manually declare deriving instance Data a => Data (CI a)
, because the constructors are not exported.
There's a bunch of libraries requiring types to have Data
instance, and the aforementioned limitations render CI
simply impossible to use with them.
Want to see a practical example? The acid-state
library requires types to derive Data
, and I simply can't declare the following type:
newtype Tag = Tag (CI Text)
deriving (Eq, Ord, Show, Typeable, Data)
I just hit this too.
Ok. I reconsidered it and concluded that while providing a Data instance is unsafe, users have to go out of their way to create an invalid CI.
I derived a Data instance and released it as 1.2.0.0.
This solves #9