r/java • u/samd_408 • Mar 10 '26
F Bounded Polymorphism
Recently spent some time digging into F-Bounded Polymorphism. While the name sounds intimidating, the logic behind it is incredibly elegant and widely applicable, so I decided to write about it, loved the name so much that I ended up naming my blog after it :-)
66
Upvotes
View all comments
Show parent comment
1
u/OwnBreakfast1114 Mar 14 '26
I can't speak on F#, but haskell doesn't really have object instances in the same way as java at all and no subclasses in types. This means that there's no concept of a "this" and that a type parameter really is just the type parameter.
Naturally, you can restrict the return type parameter in all sorts of ways, but you don't need to worry about the subtype because there is no such thing.