
oh well thats pretty straightforward:)
the next thing i don't understand is how ghci turns 1 into (Scalar 1).
1 == (Scalar 1) returns True, which is logical in a way (NOT), but if i
change the type definition to
data Matrix a = Matr {unMatr :: [[a]]}  Lol a  Scalar a
then
1 == (Scalar 1) still returns True, but
1 == (Lol 1) returns False, no matter in what order I put them in the
definition... o.O
Felipe Lessa wrote:
>
> On Tue, Dec 22, 2009 at 09:03:44AM 0800, slemi wrote:
>> this allows me to use the (^^) powering operator, which works fine with
>> nonzero 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/base4.2.0.0/src/GHCReal.html#%5E
>
> 
> Felipe.
> _______________________________________________
> HaskellCafe mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/haskellcafe
>
>

View this message in context:
http://old.nabble.com/poweringofnewtypestp26891202p26891742.html
Sent from the Haskell  HaskellCafe mailing list archive at Nabble.com.
_______________________________________________
HaskellCafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskellcafe

