Haskell has this very nice consistency.... I'll diverge into perl

The 'Show' role provides consistent stringification semantics for
any type that does the role. It can even 'derive' the role, getting
a method autogenerated.

The 'Ord' role provides semantics for ordered types. A typical
structure that uses this is the map - it is a sorted collection of
stuff, and the key must do the 'Ord' role.

And so on and so forth.

Meanwhile in perl 5 land we have:

        * eq vs ==
        * stringifying objects is rarely meaningful
        * there isn't a culture of "functional programming" like reuse -
          we do it on an entirely different level.

Can this fit into perl 6?

As I see it == is the generic comparison, and 'eq' is == with
coercing parameters (in Haskell it'd be
eq :: (Show a) => a -> a -> Bool or so... Isn't that lovely?)

Anywho, my point is - there's lots we can borrow to make our
Prelude.pm prettier, and our code a little more generic.

Mechanical conversion from perl 5 can use the fully qualified
instances of '==' and 'eq' in the Str and Num roles.

 ()  Yuval Kogman <[EMAIL PROTECTED]> 0xEBD27418  perl hacker &
 /\  kung foo master: /me beats up some cheese: neeyah!!!!!!!!!!!!!!!!!

Attachment: pgpwRyt0U4VsD.pgp
Description: PGP signature

Reply via email to