Wanted: local data, class, instance declarations

John Meacham john at repetae.net
Wed Feb 1 22:03:06 EST 2006


On Wed, Feb 01, 2006 at 09:58:15PM -0500, Manuel M T Chakravarty 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.

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

        John

-- 
John Meacham - ⑆repetae.net⑆john⑈ 


More information about the Haskell-prime mailing list