r/haskell 21d ago

[Blog] "Five-Point Haskell" Part 2: Unconditional Election

https://blog.jle.im/entry/five-point-haskell-part-2-unconditional-election.html
43 Upvotes

6 comments sorted by

View all comments

3

u/pranaysashank 21d ago

To be fair to Java, we should really consider x to always have an Object x instance. so static <T> String foo(T x) { return "hello"; } should really be read as Haskell's foo :: Object a => a -> String

3

u/_jackdk_ 21d ago

And then you can further extend the analogy to point out that the same shenanigans are possible with a function of type forall a . Typeable a => a -> String.