Hi,

I'm a complete Raku novice and I'm still at the stage of understanding
how the major language features are used idiomatically.

As an exercise I'd like to do the equivalent of Haskell's typeclass
implementation for the built in numeric types.  I understand this may
well be a misguided exercise!

Raku Roles look ideal for capturing parametric polymorphic behaviour,
e.g. an additive group:

    role AddGroup[::A] {
      # methods omitted for now.
    }

Ideally the built-in Int, Rat etc classes could retro-actively "do"
the role, in this style, using invalid Raku:

    class Int does AddGroup {...}  # Not valid Raku.

I can see a pragma called MONKEY-TYPING that could be relevant but
sounds like it's not intended to be used for day to day problems like
this?

Can anyone point me towards a more idiomatic Raku way of doing this?

Thanks,

Stu

Reply via email to