[project @ 1996-01-08 20:28:12 by partain]
[ghc-hetmet.git] / ghc / compiler / tests / deSugar / ds040.hs
1 --!!! Another bug in overloaded n+k patts
2 --
3
4 main _ = [AppendChan stdout (shows ((4::Int) ^^^^ (6::Int)) "\n")]
5
6 (^^^^)          :: (Num a, Integral b) => a -> b -> a
7 x ^^^^ 0                =  1
8 x ^^^^ (n+1)    =  f x n x
9                    where f _ 0 y = y
10                          f x n y = g x n  where
11                                    g x n | even n  = g (x*x) (n `quot` 2)
12                                          | otherwise = f x (n-1) (x*y)
13 _ ^^^^ _                = error "(^^^^){Prelude}: negative exponent"