Or am I barking up the completely wrong tree here, i.e., this isn't a functor issue?

Yes you are barking up the wrong tree/no this isn't a Functor issue.

> create just one generic plus that would handle both the plus :: Int -> Int -> Int and the plus2 :: MyNum -> MyNum -> MyNum.

A Functor would need to be of the form of a parameterised type. That is, the `f` in `f a`. Neither `Int` nor `MyNum` are parameterised.

You want a plus-like method that's polymorphic/generic across different Peano-like numeric representations. IOW you want an overloading. That's what typeclasses are for:

> class PolyPlus a where polyPlus :: a -> a -> a
>
> instance PolyPlus Int where polyPlus = plus
>
> instance PolyPlus MyNum where polyPlus = plus2

(In those instances you could just put the definitions for those functions/no need to define them separately. BTW both those definitions are truly horrible non-idiomatic Haskell. Why are you trying to write C code in Haskell?)


AntC