4 ms·
Apply reverse, tail, etc. on the result of 'map' and you get something of the same type. Types don't tell all.
by strager 13y ago
Apply reverse, tail, etc. on the result of 'map' and you get something of the same type. Types don't tell all.
- FreeFull 13y agoWhat if you use a vector whole length is indexed by a Natural in the type signature? It would still allow permutations and such (like reverse), but not tail. Using a dependent type system, it would actually be possible to statically ensure that map can only map, and do nothing else whatsoever, but it does become rather unwieldy.