
Roelof Wobben
I don't think I want that. I want to type this 2^3 and then the outcome will be 8. So next try
(^) :: Int -> Int -> Int
Because the first and second numbers are integers and the outcome also will be a integer.
This looks more like it. Now forget about programming for a moment and think about how you can express the exponentiation operation in terms of simple equations. Let me show you how you would do that for addition of natural numbers, if you have only successor (succ) and predecessor (pred) functions available: x + 0 = x x + y = succ x + pred y Evaluation shows: 3 + 2 = succ 3 + pred 2 = 4 + 1 = succ 4 + pred 1 = 5 + 0 = 5 A similarly simple ruleset can express exponentiation, too. Greets, Ertugrul -- nightmare = unsafePerformIO (getWrongWife >>= sex) http://ertes.de/