[email protected]
[Top] [All Lists]

Re: [Haskell-cafe] powering of new types

Subject: Re: [Haskell-cafe] powering of new types
From: Felipe Lessa
Date: Tue, 22 Dec 2009 15:37:57 -0200
On Tue, Dec 22, 2009 at 09:03:44AM -0800, slemi wrote:
> this allows me to use the (^^) powering operator, which works fine with
> non-zero exponents.
> however to my surprise when i try (^^ 0) the answer is (Scalar 1), and not
> the identity matrix as expected.
> does this mean that (a ^^ 0) is not defined as (a ^^ 1 * a ^^ (-1)) (or
> better yet (a / a)) in the prelude?
> if so, can i redefine it so that it gives the right answer?
> i am also very interested in how ghci got the answer (Scalar 1), it seems
> quite magical:)

(^^ 0) == const 1, see this link:

http://haskell.org/ghc/docs/latest/html/libraries/base-4.2.0.0/src/GHC-Real.html#%5E

--
Felipe.
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

<Prev in Thread] Current Thread [Next in Thread>