In Haskell, you're right, you do this by putting every primitive function in its own typeclass.
I think it's a bit harder than that: you'd need a typeclass for every function's interface and every intersection of those interfaces that occurs. So if you had
foo buffy = spoffle buffy (winnow buffy)
bar angel = spodify angel (winnow angel)
then you'd need typeclasses as follows:
class Winnow where
winnow :: a -> Winnowed a
class Fooable where
spoffle :: Winnow a => a->(Winnowed a)->(Foo a)
class Barable where
spodify :: Winnow a => a->(Winnowed a)->(Bar a)
no subject
I think it's a bit harder than that: you'd need a typeclass for every function's interface and every intersection of those interfaces that occurs. So if you had then you'd need typeclasses as follows: