3 ms·
This advantage can be overstated and give a false sense of security, though. It’s true that for entirely generic functions, you can sometimes infer useful prope
by Chris_Newton 6y ago
This advantage can be overstated and give a false sense of security, though. It’s true that for entirely generic functions, you can sometimes infer useful properties just from the type signature, but once you start getting any more specific types in there, all bets may be off. You said
[of course this is assuming that `any` isn't implemented as `any _ _ = True`]
but actually there are many more possibilities. For example, this function might return True if the provided data structure has exactly 5 elements, never using the provided (a -> Bool) function or mapping over anything.
- uryga 6y agoyou're right! but i think under normal circumstances it's fair to assume that the function actually uses all of its arguments. and i mean "uses" in a general handwavy sense, e.g. that it doesn't do `any f xs = length (fmap f xs)`, where `f` is technically used, but the results of applying `f` are instantly dropped.