I am studying Haskell. I have the next question:
The List type is a basic type in Haskell.
Array in Haskell is based on lists. This is the list of indices [Ix a] and function presents by table – list of pairs [(Ix a,Value)]. Why is Array faster than lists, if inside it use lists?
I am afraid you’re wrong.
There’re several implementations of arrays in Haskell, but as far as I understand, all of them are implemented on top of contiguous memory arrays. Because of this there’s a possibility of O(1) access to element for reading.
Similarity between arrays and lists exists only on operation set level.