Here is one implementation of power function in Haskell. But I have stack overflow error. No idea how to fix
power''::Integer->Integer->Integer
power'' _ 0=1
power'' 1 _=1
power'' n k
|even k = power'' (n*n) (k `div` 2)
|otherwise = n * power'' n k-1