News for hackers. Stuff that matters.
Re:Go generics are not bad by rachitnigam on Friday July 08, 2022 @07:56PM (#32029640)
Not quite. This also has the type ‘a -> ‘a:

def nitpick(x): throw “foo”

Re:Go generics are not bad by VirusNewbie on Friday July 08, 2022 @11:10PM (#32031170)
that's not a function (in the pedantic sense).

technically a partial function, or you could say that every function is really of the type A -> Exception \/ A

Re:Go generics are not bad by Cobord on Saturday July 09, 2022 @12:16AM (#32031597)
But you should not be writing functions that make you think about the fact that Hask is not really a category.
Re:Go generics are not bad by anyfoo on Friday July 08, 2022 @08:37PM (#32030034)
You're right, and foo x = foo x also qualifies as 'a -> 'a. The only function that always terminates is the identity function, then.
Re:Go generics are not bad by xigoi on Saturday July 09, 2022 @05:48AM (#32033453)
A function in the mathematical sense is total (always terminates).
Re:Go generics are not bad by tsimionescu on Saturday July 09, 2022 @01:35AM (#32032097)
We could throw some unsafePerformIO in there and do anything else as well, but if course we would have a function in the mathematical sense anymore.