4 ms·
Not quite. This also has the type ‘a -> ‘a: def nitpick(x): throw “foo”
by rachitnigam 4y ago
Not quite. This also has the type ‘a -> ‘a:
def nitpick(x):
throw “foo”
- deleted 4y ago[deleted]
- anyfoo 4y agoYou're right, and foo x = foo x also qualifies as 'a -> 'a. The only function that always terminates is the identity function, then.
- tsimionescu 4y agoWe 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.
- xigoi 4y agoA function in the mathematical sense is total (always terminates).
- VirusNewbie 4y agothat'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
- Cobord 4y agoBut you should not be writing functions that make you think about the fact that Hask is not really a category.