How to fix “variable not in scope” error in GHCI?

I see you are defining your function in interactive shell. Most of Haskell’s REPLs read and eval instructions line-by-line, so when you type potencia :: Integer -> Integer -> Integer it is interpreted right at this moment, so compiler complains that potencia is lacking implementation. You should either: Define it in external file and load it using :l (recommended) Type :set … Read more