4 ms·
It is actually annoying from a very practical point of view. You cannot, for example, write an algorithm that will work an any sequence type, and then apply it
by pathsjs 10y ago
It is actually annoying from a very practical point of view. You cannot, for example, write an algorithm that will work an any sequence type, and then apply it to a list. This is why, for instance, you have List.map and so on
- Drup 10y agoYou can, that's precisely why we have functors and for this kind of use cases (abstracting a module over another), they are much nicer than type classes.
- pathsjs 10y agoAs far as I understand, this would only work if standard sequence types were defined inside a functor, which is not the case.
- ufo 10y agoThe Ocaml std library is a bit lackluster and people often replace it with something more featureful. BTW, I think https://github.com/c-cube/sequence https://github.com/c-cube/sequence is more in closer to the generic iterable datatype you are looking for. You still need to convert to and from the seq type but its pretty close...