Wanted: local data, class, instance declarations

Bulat Ziganshin bulatz at HotPOP.com
Thu Feb 2 07:34:57 EST 2006


Hello John,

Thursday, February 02, 2006, 6:03:06 AM, you wrote:

>> Unfortunately, local instance declarations threaten the coherence
>> property of type classes and principle types.  See for example,
>> ``Functional pearl: implicit configurations—or, type classes reflect the
>> values of types'', Sect 6.1, for a bit of discussion.
>> 
>> So, this extension would require a very carefully thought out proposal.

JM> Also, the need for it is questionable if we were to allow polymorphic
JM> components and newtype deriving. if your data acts differently then it
JM> should be a different type with a newtype and derive all the properties
JM> where it acts the same. if you want to do different things to the same
JM> data then packaging them up as values in a record with polymorphic
JM> components makes perfect sense and is more functional in nature. That
JM> class instances are global is a great feature of them, not a weakness.

John, local definitions used in Generic Haskell (which you may don't
know) and even in the SYB. are you really think that if we need two
different algorithms of processing Identifier inside folds, then we
should define two different Identifier types?



-- 
Best regards,
 Bulat                            mailto:bulatz at HotPOP.com





More information about the Haskell-prime mailing list