How come tail throws an exception in Haskell? Isn't it "impure"?