What Time Complexity Does Haskell's "tail"-Function Have?

Viewed 1566

I was reading a tutorial on Haskell when I thought to myself; what time complexity does Haskell's tail function have (and why)? (I cannot find an answer in any documentation)

I would guess that for a list of size n, the tail function would be O(n), i.e just copying over the tail to a new list and returning that one. But then again, I do not know too much about the underlying architecture of Haskell (I'm new to the language).

Of course, I could time it. But I don't know how to time stuff in Haskell yet, and I also want to learn how Haskell handles the problem, to justify why it is O(n)/O(1) or whatever.

Thanks in advance :)

2 Answers
Related