data SomeType ...
f1 :: SomeType -> SomeOtherType
f1 this = whatever this >> ...
Same idea, different syntax. (Type classes will allow polymorphism, if that's what you're after.)
You are thinking of the abstraction in terms of its implementation. There is no reason why a method in a class would physically be in that class; the class just acts as a namespace:
OO:
FP: Same idea, different syntax. (Type classes will allow polymorphism, if that's what you're after.)You are thinking of the abstraction in terms of its implementation. There is no reason why a method in a class would physically be in that class; the class just acts as a namespace:
and are the same.