Bjorn Bringert: > On http://hackage.haskell.org/trac/haskell-prime/wiki/ > DerivedInstances it says: > > "- There is no way to derive an instance of a class for a data type > that is defined elsewhere (in another module)." > > Though there is no proposal to fix this. Would such a proposal be > appropriate for Haskell'?
I think this would be a useful feature to have. (I certainly wished to have independent deriving declarations many times when writing Haskell code.) It also seems to be a fairly small, well understood extension. > If so, I propose to add a top-level declaration on the form: > > 'deriving' qtycls 'for' qtycon > > which produces the same instance as a deriving clause in the > declaration of the datatype or newtype would. I guess, the right way to go about this would be to say that independent deriving declarations are the fundamental way of deriving a type class. The original form of a deriving clause at a data/newtype declaration is, then, just a syntactic shorthand for a data/newtype declaration plus a bunch of independent deriving declarations. What is not so nice is that you take a new keyword ('for'), which is quite likely to have been used as a variable name in existing code. (Or does it work out to use one of the 'special' names here?) I think it would be useful to write the proposal in complete detail up on the Haskell' wiki. Manuel _______________________________________________ Haskell-prime mailing list Haskell-prime@haskell.org http://www.haskell.org/mailman/listinfo/haskell-prime