Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
第3章 練習問題 B
(^^)
はどのように定義するか
import Prelude hiding ((^^)) (^^) :: (Fractional a, Integral b) => a -> b -> a x ^^ p = if p < 0 then recip (x ^ abs p) else x ^ p
- (^^) :: (Fractional a, Integral b) => a -> b -> a
Documentation
(^^) :: (Fractional a, Integral b) => a -> b -> a Source #
>>>
2.5 ^^ 2
6.25>>>
2.5 ^^ (-2)
0.16