3 ms·
> Of course that type doesn't encode everything there is to know about that function, even assuming purity. Right—we need to require foo id = id.
by euiq 6y ago
> Of course that type doesn't encode everything there is to know about that function, even assuming purity.
Right—we need to require foo id = id.
- tsimionescu 6y agoThat only works because Haskell can't really express it. That is, if you could write Haskell code that checked that equality, that equality wouldn't be enough, because you could write a function `mapStrange foo [x]` that is equal to `map` if `foo = id` and is something else otherwise. But since you can't compare 2 functions for equality, and you can't compare two arbitrary values for equality, then yes - your informal requirement is enough togethet with the type to force the function to be `map`.