On 8/3/07, Chris Smith <[EMAIL PROTECTED]> wrote:
> Yes, unless of course you did:
>
>     instance (Monad m, Num n) => Num (m n)
>
> or some such nonsense. :)

I decided to take this as a dare - at first I thought it would be easy
to declare (Monad m, Num n) => m n to be an instance of Num (just lift
or return the operators as necessary), but I ran into trouble once I
realized I needed two things I wasn't going to get:

An instance of Eq (m n), and an instance of Show (m n) for all monads
m.  Eq would need a function of the form:

(==) :: Monad m => m a -> m a -> Bool

and Show would need a function of type m a -> String

There's no way I'm getting a function of those types using return and
join to operate on the monad.

So, there went that idea.

-Antoine
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to