On Fri, Feb 24, 2012 at 3:07 PM, Barney Hilken <[email protected]> wrote:
> But the difference is that <= is (potentially) an arbitrary function, so we
> need to be careful that the instances make sense. A formally correct system
> would insist that all instances are (at least) reflexive and transitive. But
> in the case of records, we know what the instances are: they are projection
> functions. Every single (automatically generated) instance does exactly the
> same thing: it projects out one component of a record. This isn't like OO
> polymorphism, where "messages" are actually arbitrary functions which could
> do anything, the polymorphism is exactly the same as that of fst and snd.
I appreciate the difference and it might be enough of a difference
(from e.g. OO systems) that the problems seen there won't show up in
Haskell under a new record system.
Aside: It is possible to have no scalar fields in records of course.
data R = C { compare :: (a -> a -> Ordering) }
-- Johan
_______________________________________________
Glasgow-haskell-users mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users